Ruby ternary operator if else -


how make ternary?

if @user.skill.present?     @skill = @user.skill else     @skill = skill.new end  

@skill = @user.skill || skill.new 

if value of @user.skill if nil, asign next value( skill.new) @skill.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -