inossidabile/protector

View on GitHub
lib/protector/adapters/active_record/collection_proxy.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Protector
  module Adapters
    module ActiveRecord
      # Patches `ActiveRecord::Associations::CollectionProxy`
      module CollectionProxy
        extend ActiveSupport::Concern
        delegate :protector_subject, :protector_subject?, :to => :@association

        def restrict!(*args)
          @association.restrict!(*args)
          self
        end
      end
    end
  end
end