Module: Mongoid::Scopable
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
ActiveSupport::Concern
|
|
Defined in: | lib/mongoid/scopable.rb |
Overview
This module contains behavior for all ::Mongoid
scoping - named scopes, default scopes, and criteria accessors via scoped and unscoped.
Instance Method Summary
-
#apply_default_scoping ⇒ true | false
private
Internal use only
Internal use only
Apply the default scoping to the attributes of the document, as long as they are not complex queries.
DSL Calls
included
[ GitHub ]11 12 13 14 15
# File 'lib/mongoid/scopable.rb', line 11
included do class_attribute :default_scoping class_attribute :_declared_scopes self._declared_scopes = {} end
Instance Method Details
#apply_default_scoping ⇒ true
| false
(private)
This method is for internal use only.
Apply the default scoping to the attributes of the document, as long as they are not complex queries.
# File 'lib/mongoid/scopable.rb', line 28
def apply_default_scoping if default_scoping default_scoping.call.selector.each do |field, value| attributes[field] = value unless value.respond_to?(:each) end end end