Module: ActiveRecord::Associations::ThroughAssociation

Defined in:
lib/break_dance/application_record_additions.rb

Instance Method Summary collapse

Instance Method Details

#target_scopeObject



50
51
52
53
54
55
56
57
58
59
# File 'lib/break_dance/application_record_additions.rb', line 50

def target_scope
  scope = super
  reflection.chain.drop(1).each do |reflection|
    relation = reflection.klass.unsecured!.all
    scope.merge!(
      relation.except(:select, :create_with, :includes, :preload, :joins, :eager_load)
    )
  end
  scope
end