Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo_odm/core_ext/conversions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.type_cast(value) ⇒ Object



152
153
154
155
# File 'lib/mongo_odm/core_ext/conversions.rb', line 152

def self.type_cast(value)
  return nil if value.nil?
  value.to_date
end

Instance Method Details

#to_mongoObject



157
158
159
# File 'lib/mongo_odm/core_ext/conversions.rb', line 157

def to_mongo
  Time.utc(self.year, self.month, self.day)
end