Module: Protector::Adapters::ActiveRecord::Association

Extended by:
ActiveSupport::Concern
Defined in:
lib/protector/adapters/active_record/association.rb

Overview

Patches ActiveRecord::Associations::SingularAssociation and ActiveRecord::Associations::CollectionAssociation

Instance Method Summary collapse

Instance Method Details

#scope_with_protector(*args) ⇒ Object

Wraps every association with current subject



19
20
21
22
23
# File 'lib/protector/adapters/active_record/association.rb', line 19

def scope_with_protector(*args)
  scope = scope_without_protector(*args)
  scope = scope.restrict!(owner.protector_subject) if owner.protector_subject?
  scope
end