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, #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

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

Constructor Details

This class inherits a constructor from ActiveModel::Type::Value

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