Module: Mongoid::Extensions::Date
- Defined in:
- lib/mongoid/extensions/date.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- EPOCH =
Deprecated.
No longer used as a return value from #mongoize passed an invalid date string.
Constant for epoch - used when passing invalid times.
::Date.new(1970, 1, 1)
Instance Method Summary collapse
-
#__mongoize_time__ ⇒ Time | ActiveSupport::TimeWithZone
Convert the date into a time.
-
#mongoize ⇒ Time
Turn the object from the ruby type we deal with to a Mongo friendly type.
Instance Method Details
#__mongoize_time__ ⇒ Time | ActiveSupport::TimeWithZone
Convert the date into a time.
22 23 24 |
# File 'lib/mongoid/extensions/date.rb', line 22 def __mongoize_time__ ::Time.configured.local(year, month, day) end |
#mongoize ⇒ Time
Turn the object from the ruby type we deal with to a Mongo friendly type.
33 34 35 |
# File 'lib/mongoid/extensions/date.rb', line 33 def mongoize ::Date.mongoize(self) end |