Method: Mongoid::Criteria#method_missing
- Defined in:
- lib/mongoid/criteria.rb
#method_missing(name, *args) ⇒ Object
Used for chaining Criteria scopes together in the for of class methods on the Document the criteria is for.
Options:
name: The name of the class method on the Document to chain. args: The arguments passed to the method.
Returns: Criteria
166 167 168 169 170 171 172 173 174 |
# File 'lib/mongoid/criteria.rb', line 166 def method_missing(name, *args) if @klass.respond_to?(name) new_scope = @klass.send(name, *args) new_scope.merge(self) return new_scope else return entries.send(name, *args) end end |