module Protector::Adapters::ActiveRecord::Preloader::Association
Patches ‘ActiveRecord::Associations::Preloader::Association`
Public Instance Methods
protector_subject()
click to toggle source
Gets current subject of preloading association
# File lib/protector/adapters/active_record/preloader.rb, line 20 def protector_subject # Owners are always loaded from the single source # having same protector_subject owners.first.protector_subject end
protector_subject?()
click to toggle source
# File lib/protector/adapters/active_record/preloader.rb, line 26 def protector_subject? owners.first.protector_subject? end
scope_with_protector(*args)
click to toggle source
Restricts preloading association scope with subject of the owner
# File lib/protector/adapters/active_record/preloader.rb, line 31 def scope_with_protector(*args) return scope_without_protector unless protector_subject? @meta ||= klass.protector_meta.evaluate(protector_subject) scope_without_protector.merge(@meta.relation) end