Module: Mongoid::DefaultScope::ClassMethods
- Defined in:
- lib/mongoid/default_scope.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#default_scope(conditions = {}) ⇒ Object
Creates a default_scope for the
Document
, similar to ActiveRecord’s default_scope.
Instance Method Details
#default_scope(conditions = {}) ⇒ Object
Creates a default_scope for the Document
, similar to ActiveRecord’s default_scope. DefaultScopes
are proxied Criteria
objects that are applied by default to all queries for the class.
31 32 33 |
# File 'lib/mongoid/default_scope.rb', line 31 def default_scope(conditions = {}) self.default_scoping = Scope.new(conditions).conditions.scoped end |