Contains utility methods for object id conversion.
Mark the provided object as unconvertable to bson or not, and always return the provided object.
@example Flag the object.
Conversions.flag(metadata, 15)
@param [ Object ] object The object to flag. @param [ Metadata ] The relation metadata.
@return [ Object ] The provided object.
@since 2.3.0
# File lib/mongoid/relations/conversions.rb, line 20 def flag(object, metadata) inverse = metadata.inverse_klass if inverse.using_object_ids? || object.is_a?(BSON::ObjectId) object else object.tap do |obj| if obj.is_a?(String) obj.unconvertable_to_bson = true end end end end
Generated with the Darkfish Rdoc Generator 2.