lib/mongoid/association/constrainable.rb
# Convert the supplied object to the appropriate type to set as the
# foreign key for a relation.
#
# @example Convert the object.
#   constraint.convert("12345")
#
# @param [ Object ] object The object to convert.
#
# @return [ Object ] The object cast to the correct type.
#
# @since 2.0.0.rc.7
Convert the supplied object to the appropriate type to set as the
foreign key for a relation.
Convert the supplied object to the appropriate type to set as the foreign key for a relation .
def convert_polymorphic(object)
        if object.is_a?(Mongoid::Document)
          object.id
        else
          BSON::ObjectId.mongoize(object)
        end
      end
def convert_polymorphic ( object ) if object . is_a? ( Mongoid :: Document ) object . id else BSON :: ObjectId . mongoize ( object ) end end
Convert the supplied object to the appropriate type to set as the
foreign key for a relation.
Convert the supplied object to the appropriate type to set as the foreign key for a relation .
The object cast to the correct type.
The object cast to the correct type .
 Object 
object
object The object to convert.
object The object to convert .
example
Convert the object.
Convert the object .
since
None