Module: ActiveRecordFlagSupport::FlagInstanceMethods
- Defined in:
- lib/activerecord_flag_support.rb
Instance Method Summary collapse
-
#set_flag(field, value, bit_field) ⇒ Object
——————————————————————- set_flag.
Instance Method Details
#set_flag(field, value, bit_field) ⇒ Object
——————————————————————- set_flag
44 45 46 47 48 49 50 51 52 |
# File 'lib/activerecord_flag_support.rb', line 44 def set_flag( field, value, bit_field ) if value && ActiveRecord::ConnectionAdapters::Column.value_to_boolean( value ) ( send(field).to_i | bit_field ) else ( send(field).to_i & (~bit_field) ) end self.send( "#{field}=", value ) attributes_before_type_cast[field] = value end |