class ActiveRecord::Base
Public Class Methods
acts_as_association_scope(only: reflections.keys, except: [])
click to toggle source
# File lib/association_scope.rb, line 18 def self.acts_as_association_scope(only: reflections.keys, except: []) # Apply given filters. # Don't be picky about singular or plural. raise ArgumentError, "Don't use :only and :except together!" unless only == reflections.keys || except == [] only = only.map { |o| o.to_s } except = except.map { |e| e.to_s } ::AssociationScope::Scope.inject_scopes(self, only - except) end