Convert the provided object to a propery array of foreign keys.
@example Mongoize the object.
Array.__mongoize_fk__(constraint, object)
@param [ Constraint ] constraint The metadata constraint. @param [ Object ] object The object to convert.
@return [ Array ] The array of ids.
@since 3.0.0
# File lib/mongoid/extensions/array.rb, line 135 def __mongoize_fk__(constraint, object) if object.resizable? object.blank? ? object : constraint.convert(object) else object.blank? ? [] : constraint.convert(Array(object)) end end
Turn the object from the ruby type we deal with to a Mongo friendly type.
@example Mongoize the object.
Array.mongoize([ 1, 2, 3 ])
@param [ Object ] object The object to mongoize.
@return [ Array ] The object mongoized.
@since 3.0.0
# File lib/mongoid/extensions/array.rb, line 154 def mongoize(object) if object.is_a?(::Array) evolve(object).collect{ |obj| obj.class.mongoize(obj) } else evolve(object) end end
Generated with the Darkfish Rdoc Generator 2.