Class: ActiveModel::Type::Date

Inherits:
Value show all
Defined in:
activemodel/lib/active_model/type/date.rb

Overview

:nodoc:

Direct Known Subclasses

ActiveRecord::Type::Date

Instance Attribute Summary

Attributes inherited from Value

#limit, #precision, #scale

Instance Method Summary collapse

Methods inherited from Value

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

Constructor Details

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

Instance Method Details

#serialize(value) ⇒ Object


10
11
12
# File 'activemodel/lib/active_model/type/date.rb', line 10

def serialize(value)
  cast(value)
end

#typeObject


6
7
8
# File 'activemodel/lib/active_model/type/date.rb', line 6

def type
  :date
end

#type_cast_for_schema(value) ⇒ Object


14
15
16
# File 'activemodel/lib/active_model/type/date.rb', line 14

def type_cast_for_schema(value)
  "'#{value.to_s(:db)}'"
end