Method: Mongoid::Extensions::Array#delete_one
- Defined in:
- lib/mongoid/extensions/array.rb
#delete_one(object) ⇒ Object
Delete the first object in the array that is equal to the supplied object and return it. This is much faster than performing a standard delete for large arrays ince it attempt to delete multiple in the other.
106 107 108 109 |
# File 'lib/mongoid/extensions/array.rb', line 106 def delete_one(object) position = index(object) position ? delete_at(position) : nil end |