module Protector::Adapters::ActiveRecord::Association

Patches ‘ActiveRecord::Associations::SingularAssociation` and `ActiveRecord::Associations::CollectionAssociation`

Public Instance Methods

build_record_with_protector(*args) click to toggle source

Forwards protection subject to the new instance

# File lib/protector/adapters/active_record/association.rb, line 30
def build_record_with_protector(*args)
  return build_record_without_protector(*args) unless protector_subject?
  build_record_without_protector(*args).restrict!(protector_subject)
end
scope_with_protector(*args) click to toggle source

Wraps every association with current subject

# File lib/protector/adapters/active_record/association.rb, line 23
def scope_with_protector(*args)
  scope = scope_without_protector(*args)
  scope = scope.restrict!(protector_subject) if protector_subject?
  scope
end