Method: Mongoid::Criteria::Modifiable#find_or_create_by
- Defined in:
- lib/mongoid/criteria/modifiable.rb
#find_or_create_by(attrs = {}, &block) ⇒ Document
Find the first Document
given the conditions, or creates a new document with the conditions that were supplied.
87 88 89 |
# File 'lib/mongoid/criteria/modifiable.rb', line 87 def find_or_create_by(attrs = {}, &block) find_or(:create, attrs, &block) end |