Module: Mongoid::Relations::Conversions
Overview
Contains utility methods for object id conversion.
Instance Method Summary collapse
-
#flag(object, metadata) ⇒ Object
Mark the provided object as unconvertable to bson or not, and always return the provided object.
Instance Method Details
#flag(object, metadata) ⇒ Object
Mark the provided object as unconvertable to bson or not, and always return the provided object.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mongoid/relations/conversions.rb', line 21 def flag(object, ) inverse = .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 |