instance method
_read_attribute
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v6.1.7.10Signature
_read_attribute(attr_name)
No documentation comment.
Parameters
-
attr_namereq
Source
# File activerecord/lib/active_record/attribute_methods/read.rb, line 105
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
Defined in activerecord/lib/active_record/attribute_methods/read.rb line 105
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::Read