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, #default_timezone, #is_utc?, #type_cast_for_schema, #user_input_in_time_zone

Methods inherited from ActiveModel::Type::Value

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

Constructor Details

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

Instance Method Details

#serialize(value) ⇒ Object


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

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