Module: Coercell::Value
- Defined in:
- lib/coercell/value.rb
Class Method Summary collapse
Class Method Details
.coerce(model, attribute_name, value) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/coercell/value.rb', line 3 def self.coerce(model,attribute_name,value) attribute_type = (model.columns.select { |a| a.name == attribute_name }).first.type value = case attribute_type when :integer value.to_i if value.is_a? Numeric else value end value end |