Module: Mongoid::Extensions::DateTime::ClassMethods
- Defined in:
- lib/mongoid/extensions/date_time.rb
Instance Method Summary collapse
-
#demongoize(object) ⇒ DateTime | nil
Convert the object from its mongo friendly ruby type to this type.
-
#mongoize(object) ⇒ Time
Turn the object from the ruby type we deal with to a Mongo friendly type.
Instance Method Details
#demongoize(object) ⇒ DateTime | nil
Convert the object from its mongo friendly ruby type to this type.
41 42 43 |
# File 'lib/mongoid/extensions/date_time.rb', line 41 def demongoize(object) ::Time.demongoize(object).try(:to_datetime) end |
#mongoize(object) ⇒ Time
Turn the object from the ruby type we deal with to a Mongo friendly type.
54 55 56 |
# File 'lib/mongoid/extensions/date_time.rb', line 54 def mongoize(object) ::Time.mongoize(object) end |