Method: MongoModel::Scope::FinderMethods#apply_finder_options

Defined in:
lib/mongomodel/support/scope/finder_methods.rb

#apply_finder_options(options = {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/mongomodel/support/scope/finder_methods.rb', line 49

def apply_finder_options(options={})
  result = clone

  result = result.where(options[:conditions]) if options[:conditions]
  result = result.order(options[:order])      if options[:order]
  result = result.select(options[:select])    if options[:select]
  result = result.limit(options[:limit])      if options[:limit]
  result = result.offset(options[:offset])    if options[:offset]

  result
end