Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v3.2.13) is shown here.
attribute_cast_code(attr_name)
protected
The enhanced read method automatically converts the UTC time stored in the
database to the time zone stored in Time.zone.
# File activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb, line 21
def attribute_cast_code(attr_name)
column = columns_hash[attr_name]
if create_time_zone_conversion_attribute?(attr_name, column)
typecast = "v = #{super}"
time_zone_conversion = "v.acts_like?(:time) ? v.in_time_zone : v"
"((#{typecast}) && (#{time_zone_conversion}))"
else
super
end
end