module Mongoid::Scopable
This module contains behavior for all Mongoid
scoping - named scopes, default scopes, and criteria accessors via scoped and unscoped.
Private Instance Methods
apply_default_scoping()
click to toggle source
Apply the default scoping to the attributes of the document, as long as they are not complex queries.
@api private
@example Apply the default scoping.
document.apply_default_scoping
@return [ true | false ] If default scoping was applied.
# 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