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 since it does not perform multiple deletes.
91 92 93 94 |
# File 'lib/mongoid/extensions/array.rb', line 91 def delete_one(object) position = index(object) position ? delete_at(position) : nil end |