Class: ActiveRecord::AttributeMethods::TimeZoneConversion::Type

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb

Overview

:nodoc:

Instance Method Summary collapse

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

#typeObject


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