Class: ActiveRecord::AttributeMethods::TimeZoneConversion::Type
- Defined in:
- activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(column) ⇒ Type
constructor
A new instance of Type.
- #type ⇒ Object
- #type_cast(value) ⇒ Object
Constructor Details
#initialize(column) ⇒ Type
Returns a new instance of Type.
5 6 7 |
# File 'activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb', line 5 def initialize(column) @column = column end |
Instance Method Details
#type ⇒ Object
14 15 16 |
# File 'activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb', line 14 def type @column.type end |
#type_cast(value) ⇒ Object
9 10 11 12 |
# File 'activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb', line 9 def type_cast(value) value = @column.type_cast(value) value.acts_like?(:time) ? value.in_time_zone : value end |