Method: MassiveRecord::ORM::AttributeMethods::CastNumbersOnWrite#write_attribute
- Defined in:
- lib/massive_record/orm/attribute_methods/cast_numbers_on_write.rb
#write_attribute(attr_name, value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/massive_record/orm/attribute_methods/cast_numbers_on_write.rb', line 7 def write_attribute(attr_name, value) if value.present? if field = attributes_schema[attr_name] case field.type when :integer value = value.to_i when :float value = value.to_f end end end super end |