Module: Mongoid::Extensions::Date
- Defined in:
- lib/mongoid/extensions/date.rb
Overview
Adds type-casting behavior to Date class.
Defined Under Namespace
Modules: ClassMethods
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.
19 20 21 |
# File 'lib/mongoid/extensions/date.rb', line 19 def __mongoize_time__ ::Time.zone.local(year, month, day) end |
#mongoize ⇒ Time
Turn the object from the ruby type we deal with to a Mongo friendly type.
30 31 32 |
# File 'lib/mongoid/extensions/date.rb', line 30 def mongoize ::Date.mongoize(self) end |