Class User before_save :set_searchable def set_searchable self.searchable = true if self.status == :active end end >> u = User.last >>
Another cleaner way to set boolean columns without return is to use tap
return
tap
def set_searchable self.tap{|u| u.searchable = status.eql?(:active) } end