Module: Mongoid::Extensions::Array::ClassMethods
- Defined in:
- lib/mongoid/extensions/array.rb
Instance Method Summary collapse
- #__mongoize_fk__(association, object) ⇒ Array deprecated Deprecated.
-
#mongoize(object) ⇒ Array | nil
Turn the object from the ruby type we deal with to a Mongo friendly type.
-
#resizable? ⇒ true
Returns whether the object’s size can be changed.
Instance Method Details
#__mongoize_fk__(association, object) ⇒ Array
Deprecated.
Convert the provided object to a proper array of foreign keys.
118 119 120 121 122 123 124 |
# File 'lib/mongoid/extensions/array.rb', line 118 def __mongoize_fk__(association, object) if object.resizable? object.blank? ? object : association.convert_to_foreign_key(object) else object.blank? ? [] : association.convert_to_foreign_key(Array(object)) end end |
#mongoize(object) ⇒ Array | nil
Turn the object from the ruby type we deal with to a Mongo friendly type.
136 137 138 139 140 141 142 |
# File 'lib/mongoid/extensions/array.rb', line 136 def mongoize(object) return if object.nil? case object when ::Array, ::Set object.map(&:mongoize) end end |
#resizable? ⇒ true
Returns whether the object’s size can be changed.
150 151 152 |
# File 'lib/mongoid/extensions/array.rb', line 150 def resizable? true end |