diff options
author | eileencodes <eileencodes@gmail.com> | 2014-09-03 18:55:48 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2014-09-04 07:52:19 -0400 |
commit | 8dac515688e183d83192249e9552ac5042f9c593 (patch) | |
tree | 5b0f8f941aa30db4fa5658e9868f0cbecc4f6c87 /activerecord | |
parent | b8fbcc0787dde662049794ea4555c8aa52847843 (diff) | |
download | rails-8dac515688e183d83192249e9552ac5042f9c593.tar.gz rails-8dac515688e183d83192249e9552ac5042f9c593.tar.bz2 rails-8dac515688e183d83192249e9552ac5042f9c593.zip |
Follup to PR #16762
Remove chain from parameters, it's no longer needed since chain and i
are being passed via next_reflection
Change name of `reflection` to `owner_reflection` because of shadow
variable warning. The last reflection will always be the owner.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/association_scope.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index b58c902bfc..3a0ebba3e4 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -113,7 +113,7 @@ module ActiveRecord end end - def next_chain_scope(scope, table, reflection, chain, tracker, assoc_klass, foreign_table, next_reflection) + def next_chain_scope(scope, table, reflection, tracker, assoc_klass, foreign_table, next_reflection) join_keys = reflection.join_keys(assoc_klass) key = join_keys.key foreign_key = join_keys.foreign_key @@ -135,16 +135,16 @@ module ActiveRecord tables = construct_tables(chain, assoc_klass, refl, tracker) - a_reflection = chain.last + owner_reflection = chain.last table = tables.last - scope = last_chain_scope(scope, table, a_reflection, owner, tracker, assoc_klass) + scope = last_chain_scope(scope, table, owner_reflection, owner, tracker, assoc_klass) chain.each_with_index do |reflection, i| table, foreign_table = tables.shift, tables.first unless reflection == chain.last next_reflection = chain[i + 1] - scope = next_chain_scope(scope, table, reflection, chain, tracker, assoc_klass, foreign_table, next_reflection) + scope = next_chain_scope(scope, table, reflection, tracker, assoc_klass, foreign_table, next_reflection) end is_first_chain = i == 0 |