123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::TypeCaster::Map

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activerecord/lib/active_record/type_caster/map.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(klass) ⇒ Map

[ GitHub ]

  
# File 'activerecord/lib/active_record/type_caster/map.rb', line 6

def initialize(klass)
  @klass = klass
end

Instance Attribute Details

#klass (readonly, private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/type_caster/map.rb', line 20

attr_reader :klass

Instance Method Details

#type_cast_for_database(attr_name, value)

[ GitHub ]

  
# File 'activerecord/lib/active_record/type_caster/map.rb', line 10

def type_cast_for_database(attr_name, value)
  type = type_for_attribute(attr_name)
  type.serialize(value)
end

#type_for_attribute(name)

[ GitHub ]

  
# File 'activerecord/lib/active_record/type_caster/map.rb', line 15

def type_for_attribute(name)
  klass.type_for_attribute(name)
end