Module: Mongoid::Extensions::Array::ClassMethods
- Defined in:
- lib/mongoid/extensions/array.rb
Instance Method Summary collapse
-
#__mongoize_fk__(constraint, object) ⇒ Array
Convert the provided object to a propery array of foreign keys.
-
#mongoize(object) ⇒ Array
Turn the object from the ruby type we deal with to a Mongo friendly type.
-
#resizable? ⇒ true
Is the object’s size changable?.
Instance Method Details
#__mongoize_fk__(constraint, object) ⇒ Array
Convert the provided object to a propery array of foreign keys.
136 137 138 139 140 141 142 |
# File 'lib/mongoid/extensions/array.rb', line 136 def __mongoize_fk__(constraint, object) if object.resizable? object.blank? ? object : constraint.convert(object) else object.blank? ? [] : constraint.convert(Array(object)) end end |
#mongoize(object) ⇒ Array
Turn the object from the ruby type we deal with to a Mongo friendly type.
155 156 157 |
# File 'lib/mongoid/extensions/array.rb', line 155 def mongoize(object) evolve(object) end |
#resizable? ⇒ true
Is the object’s size changable?
167 168 169 |
# File 'lib/mongoid/extensions/array.rb', line 167 def resizable? true end |