Module: ActiveRecord::AttributeMethods::Read

Extended by:
ActiveSupport::Concern
Defined in:
activerecord/lib/active_record/attribute_methods/read.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

ATTRIBUTE_TYPES_CACHED_BY_DEFAULT =
[:datetime, :timestamp, :time, :date]

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, extended, included

Instance Method Details

#read_attribute(attr_name) ⇒ Object

Returns the value of the attribute identified by attr_name after it has been typecast (for example, “2004-12-12” in a data column is cast to a date object, like Date.new(2004, 12, 12)).



126
127
128
# File 'activerecord/lib/active_record/attribute_methods/read.rb', line 126

def read_attribute(attr_name)
  self.class.type_cast_attribute(attr_name, @attributes, @attributes_cache)
end