From 88f804d3a984e50e831ed466a3b8b2ab7df5ce85 Mon Sep 17 00:00:00 2001 From: Molchanov Andrey Date: Mon, 9 May 2016 22:07:50 +0300 Subject: [PATCH] Replacement cycle for readability --- .../lib/active_record/associations/association_scope.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 48437a1c9e..15844de0bc 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -124,8 +124,7 @@ def add_constraints(scope, owner, association_klass, refl, chain_head, chain_tai scope = last_chain_scope(scope, table, owner_reflection, owner, association_klass) reflection = chain_head - loop do - break unless reflection + while reflection table = reflection.alias_name unless reflection == chain_tail -- GitLab