method

cast_value

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: TimestampWithTimeZone
cast_value(value) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb, line 12
          def cast_value(value)
            time = super
            return time if time.is_a?(ActiveSupport::TimeWithZone)

            # While in UTC mode, the PG gem may not return times back in "UTC" even if they were provided to Postgres in UTC.
            # We prefer times always in UTC, so here we convert back.
            if is_utc?
              time.getutc
            else
              time.getlocal
            end
          end
Register or log in to add new notes.