Module: MassiveRecord::ORM::AttributeMethods::CastNumbersOnWrite
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/massive_record/orm/attribute_methods/cast_numbers_on_write.rb
Instance Method Summary collapse
Instance Method Details
permalink #write_attribute(attr_name, value) ⇒ Object
[View source]
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 |