Module: ActiveRecord::AttributeMethods::BeforeTypeCast
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_record/attribute_methods/before_type_cast.rb
Instance Method Summary collapse
-
#attributes_before_type_cast ⇒ Object
Returns a hash of attributes before typecasting and deserialization.
- #read_attribute_before_type_cast(attr_name) ⇒ Object
Instance Method Details
#attributes_before_type_cast ⇒ Object
Returns a hash of attributes before typecasting and deserialization.
15 16 17 18 19 20 |
# File 'lib/active_record/attribute_methods/before_type_cast.rb', line 15 def attributes_before_type_cast self.attribute_names.inject({}) do |attrs, name| attrs[name] = read_attribute_before_type_cast(name) attrs end end |
#read_attribute_before_type_cast(attr_name) ⇒ Object
10 11 12 |
# File 'lib/active_record/attribute_methods/before_type_cast.rb', line 10 def read_attribute_before_type_cast(attr_name) @attributes[attr_name] end |