Class: ActiveRecord::Type::Time

Inherits:
ActiveModel::Type::Time show all
Includes:
Internal::Timezone
Defined in:
activerecord/lib/active_record/type/time.rb

Defined Under Namespace

Classes: Value

Instance Attribute Summary

Attributes inherited from ActiveModel::Type::Value

#limit, #precision, #scale

Instance Method Summary collapse

Methods included from Internal::Timezone

#default_timezone, #initialize, #is_utc?

Methods inherited from ActiveModel::Type::Time

#type, #user_input_in_time_zone

Methods included from ActiveModel::Type::Helpers::TimeValue

#apply_seconds_precision, #type_cast_for_schema, #user_input_in_time_zone

Methods included from ActiveModel::Type::Helpers::Timezone

#default_timezone, #is_utc?

Methods inherited from ActiveModel::Type::Value

#==, #as_json, #assert_valid_value, #binary?, #cast, #changed?, #changed_in_place?, #deserialize, #force_equality?, #hash, #immutable_value, #initialize, #map, #serializable?, #type, #type_cast_for_schema, #value_constructed_by_mass_assignment?

Instance Method Details

#serialize(value) ⇒ Object



11
12
13
14
15
16
17
18
# File 'activerecord/lib/active_record/type/time.rb', line 11

def serialize(value)
  case value = super
  when ::Time
    Value.new(value)
  else
    value
  end
end

#serialize_cast_value(value) ⇒ Object

:nodoc:



20
21
22
# File 'activerecord/lib/active_record/type/time.rb', line 20

def serialize_cast_value(value) # :nodoc:
  Value.new(super) if value
end