Method: MongoMapper::Document::ClassMethods#find!
- Defined in:
- lib/mongo_mapper/document.rb
#find(: first, options) ⇒ Object #find(: last, options) ⇒ Object #find(: all, options) ⇒ Object #find(ids, options) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/mongo_mapper/document.rb', line 58 def find!(*args) = args. case args.first when :first then first() when :last then last() when :all then find_every() when Array then find_some(args, ) else case args.size when 0 raise DocumentNotFound, "Couldn't find without an ID" when 1 find_one!(.merge({:_id => args[0]})) else find_some(args, ) end end end |