module Mongoid::Extensions::Object::ClassMethods
Public Instance Methods
__mongoize_fk__(association, object)
click to toggle source
Convert the provided object to a foreign key, given the metadata key contstraint.
@example Convert the object to a fk.
Object.__mongoize_fk__(association, object)
@param [ Association
] association The association metadata. @param [ Object
] object The object to convert.
@return [ Object
] The converted object.
@since 3.0.0
# File lib/mongoid/extensions/object.rb, line 248 def __mongoize_fk__(association, object) return nil if !object || object == "" association.convert_to_foreign_key(object) end
demongoize(object)
click to toggle source
Convert the object from its mongo friendly ruby type to this type.
@example Demongoize the object.
Object.demongoize(object)
@param [ Object
] object The object to demongoize.
@return [ Object
] The object.
@since 3.0.0
# File lib/mongoid/extensions/object.rb, line 263 def demongoize(object) object end
mongoize(object)
click to toggle source
Turn the object from the ruby type we deal with to a Mongo friendly type.
@example Mongoize the object.
Object.mongoize("123.11")
@param [ Object
] object The object to mongoize.
@return [ Object
] The object mongoized.
@since 3.0.0
# File lib/mongoid/extensions/object.rb, line 278 def mongoize(object) object.mongoize end