class AssociationScope::Scope

Attributes

association[R]
model[R]

Public Class Methods

inject_scopes(model, reflections) click to toggle source
# File lib/association_scope/scope.rb, line 12
def self.inject_scopes(model, reflections)
  model.reflections.slice(*reflections).each do |association, details|
    scope_type = details.class.to_s.split("::").last

    "AssociationScope::Scope::#{scope_type}".constantize.new(model, association).apply
  end
end
new(model, association) click to toggle source
# File lib/association_scope/scope.rb, line 7
def initialize(model, association)
  @model = model
  @association = association
end