module ActiveRecord::AttributeMethods::BeforeTypeCast

Public Instance Methods

attributes_before_type_cast() click to toggle source

Returns a hash of attributes before typecasting and deserialization.

# File lib/active_record/attribute_methods/before_type_cast.rb, line 15
def attributes_before_type_cast
  @attributes
end
read_attribute_before_type_cast(attr_name) click to toggle source
# File lib/active_record/attribute_methods/before_type_cast.rb, line 10
def read_attribute_before_type_cast(attr_name)
  @attributes[attr_name]
end

Private Instance Methods

attribute_before_type_cast(attribute_name) click to toggle source

Handle *_before_type_cast for method_missing.

# File lib/active_record/attribute_methods/before_type_cast.rb, line 22
def attribute_before_type_cast(attribute_name)
  if attribute_name == 'id'
    read_attribute_before_type_cast(self.class.primary_key)
  else
    read_attribute_before_type_cast(attribute_name)
  end
end