class ActiveRecord::Type::Spanner::Time
Public Instance Methods
serialize(value, *options)
click to toggle source
Calls superclass method
# File lib/active_record/type/spanner/time.rb, line 13 def serialize value, *options return "PENDING_COMMIT_TIMESTAMP()" if value == :commit_timestamp && options.length && options[0] == :dml return "spanner.commit_timestamp()" if value == :commit_timestamp && options.length && options[0] == :mutation val = super value val.acts_like?(:time) ? val.utc.rfc3339(9) : val end
user_input_in_time_zone(value)
click to toggle source
Calls superclass method
# File lib/active_record/type/spanner/time.rb, line 20 def user_input_in_time_zone value return value.in_time_zone if value.is_a? ::Time super value end
Private Instance Methods
cast_value(value)
click to toggle source
# File lib/active_record/type/spanner/time.rb, line 27 def cast_value value if value.is_a? ::String value = value.empty? ? nil : ::Time.parse(value) end value end