Module: Mongoid::Extensions::Object::ClassMethods
- Defined in:
- lib/mongoid/extensions/object.rb
Instance Method Summary collapse
-
#__mongoize_fk__(constraint, object) ⇒ Object
Convert the provided object to a foreign key, given the metadata key contstraint.
-
#demongoize(object) ⇒ Object
Convert the object from its mongo friendly ruby type to this type.
-
#mongoize(object) ⇒ Object
Turn the object from the ruby type we deal with to a Mongo friendly type.
Instance Method Details
#__mongoize_fk__(constraint, object) ⇒ Object
Convert the provided object to a foreign key, given the metadata key contstraint.
235 236 237 238 |
# File 'lib/mongoid/extensions/object.rb', line 235 def __mongoize_fk__(constraint, object) return nil if !object || object == "" constraint.convert(object) end |
#demongoize(object) ⇒ Object
Convert the object from its mongo friendly ruby type to this type.
250 251 252 |
# File 'lib/mongoid/extensions/object.rb', line 250 def demongoize(object) object end |
#mongoize(object) ⇒ Object
Turn the object from the ruby type we deal with to a Mongo friendly type.
265 266 267 |
# File 'lib/mongoid/extensions/object.rb', line 265 def mongoize(object) object.mongoize end |