Method: MongoModel::Scope::FinderMethods#first
- Defined in:
- lib/mongomodel/support/scope/finder_methods.rb
#first(count = nil) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/mongomodel/support/scope/finder_methods.rb', line 25 def first(count=nil) if loaded? count ? to_a.first(count) : to_a.first else count ? limit(count).to_a : limit(1).to_a[0] end end |