ruby if statement one line in a string code example
Example 1: ruby if statement one line
if_condition ? if_statement : else_statement
Example 2: rails if else assignment one liner
@item.property = params[:property] ? true : false
if_condition ? if_statement : else_statement
@item.property = params[:property] ? true : false