Sha256: c062e05ed2925f6727f6a28d2316bf93e1dc168164dd3c7376ea46de5e51ef31
Contents?: true
Size: 950 Bytes
Versions: 1
Compression:
Stored size: 950 Bytes
Contents
module Protector module Adapters module ActiveRecord module Preloader extend ActiveSupport::Concern module Association extend ActiveSupport::Concern included do if method_defined?(:scope) alias_method_chain :scope, :protector else alias_method "scope_without_protector", "scoped" alias_method "scoped", "scope_with_protector" end end def protector_subject # Owners are always loaded from the single source # having same protector_subject owners.first.protector_subject end def scope_with_protector(*args) return scope_without_protector unless protector_subject @meta ||= klass.protector_meta.evaluate(klass, protector_subject) scope_without_protector.merge(@meta.relation) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
protector-0.1.0 | lib/protector/adapters/active_record/preloader.rb |