lundi 5 octobre 2015

Conditional block error in ruby

Situation :

I don't understand why this part of code works

if @sprint.nil?
  redirect_to sprints_path
else
  @sprint.define_state
end

and this part of code doesn't

@sprint.nil? ? redirect_to sprints_path : @sprint.define_state

I don't know why but in the second example program go immediately in the else block.

Question :

Someone could explain me how it can be possible?

Thanks

Aucun commentaire:

Enregistrer un commentaire