Class: ActiveModel::Type::Date

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

Overview

:nodoc:

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 'lib/active_model/type/date.rb', line 10

def serialize(value)
  cast(value)
end

#typeObject



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

def type
  :date
end

#type_cast_for_schema(value) ⇒ Object



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

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