method
_read_attribute
v3.1.0 -
Show latest stable
- Class:
ActiveRecord::AttributeMethods::Read
_read_attribute(attr_name)public
No documentation available.
# File activerecord/lib/active_record/attribute_methods/read.rb, line 110
def _read_attribute(attr_name)
attr_name = attr_name.to_s
attr_name = self.class.primary_key if attr_name == 'id'
value = @attributes[attr_name]
unless value.nil?
if column = column_for_attribute(attr_name)
if unserializable_attribute?(attr_name, column)
unserialize_attribute(attr_name)
else
column.type_cast(value)
end
else
value
end
end
end