Q:

One-line assignment: If (condition) variable = value1 else value2

How do I do something like this?
if params[:property] == nil 
 @item.property = true
else 
 @item.property = false

Always forget the proper syntax to write it in one line.
In PHP it would be like this:
@item.property=(params[:property]==nil)true:false

Is it the same in rails?

A:

use the ternary operator:
@item.property = params[:property] ? true : false

or force a boolean conversion ("not not" operation)  :
@item.property = !!params[:property]

note : in ruby, it is a common idiom not to use true booleans, as any object other than false or nil evaluates to true.

