Module: Paranoid::JoinAssociation

Extended by:
ActiveSupport::Concern
Defined in:
lib/paranoid/join_association.rb

Instance Method Summary collapse

Instance Method Details

#initialize_with_paranoid(reflection, join_dependency, parent = nil) ⇒ Object

Add conditions for eager loading



10
11
12
13
14
15
16
17
18
# File 'lib/paranoid/join_association.rb', line 10

def initialize_with_paranoid(reflection, join_dependency, parent = nil)
  result = initialize_without_paranoid(reflection, join_dependency, parent)
  chain.reverse.each_with_index do |reflection, i|
    if reflection.klass.paranoid?
      conditions[i] << reflection.klass.paranoid_condition
    end
  end
  result
end