Method: MongoModel::Scope#method_missing

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

#method_missing(method, *args, &block) ⇒ Object (protected)



149
150
151
152
153
154
155
156
157
158
159
# File 'lib/mongomodel/support/scope.rb', line 149

def method_missing(method, *args, &block)
  if Array.method_defined?(method)
    to_a.send(method, *args, &block)
  elsif klass.scopes[method]
    merge(klass.send(method, *args, &block))
  elsif klass.respond_to?(method)
    with_scope { klass.send(method, *args, &block) }
  else
    super
  end
end