Class: ActiveRecord::Type::Date

Inherits:
Value show all
Defined in:
activerecord/lib/active_record/type/date.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Value

#limit, #precision, #scale

Instance Method Summary collapse

Methods inherited from Value

#==, #binary?, #changed?, #changed_in_place?, #hash, #initialize, #number?, #text?, #type_cast_from_database, #type_cast_from_user

Constructor Details

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

Instance Method Details

#klassObject


8
9
10
# File 'activerecord/lib/active_record/type/date.rb', line 8

def klass
  ::Date
end

#typeObject


4
5
6
# File 'activerecord/lib/active_record/type/date.rb', line 4

def type
  :date
end

#type_cast_for_database(value) ⇒ Object


12
13
14
# File 'activerecord/lib/active_record/type/date.rb', line 12

def type_cast_for_database(value)
  type_cast(value)
end

#type_cast_for_schema(value) ⇒ Object


16
17
18
# File 'activerecord/lib/active_record/type/date.rb', line 16

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