Class: ActiveRecord::ConnectionAdapters::PostgreSQL::OID::TimestampWithTimeZone
- Inherits:
-
DateTime
- Object
- ActiveModel::Type::DateTime
- Type::DateTime
- DateTime
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::TimestampWithTimeZone
show all
- Defined in:
- lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb
Overview
Instance Method Summary
collapse
Methods inherited from DateTime
#type_cast_for_schema
#default_timezone, #is_utc?
Instance Method Details
#cast_value(value) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb', line 12
def cast_value(value)
return if value.blank?
time = super
return time if time.is_a?(ActiveSupport::TimeWithZone) || !time.acts_like?(:time)
if is_utc?
time.getutc
else
time.getlocal
end
end
|
#type ⇒ Object
8
9
10
|
# File 'lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb', line 8
def type
real_type_unless_aliased(:timestamptz)
end
|