From 67978d624582c8aff1abeeadec9447bddd16ef3b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 23 Jul 2013 17:02:04 -0700 Subject: [PATCH] eliminate conditional in JoinHelper --- activerecord/lib/active_record/associations/join_helper.rb | 2 +- activerecord/lib/active_record/reflection.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/associations/join_helper.rb b/activerecord/lib/active_record/associations/join_helper.rb index 5a41b40c8fc6d..27b70edf1a02a 100644 --- a/activerecord/lib/active_record/associations/join_helper.rb +++ b/activerecord/lib/active_record/associations/join_helper.rb @@ -19,7 +19,7 @@ def construct_tables if reflection.source_macro == :has_and_belongs_to_many tables << alias_tracker.aliased_table_for( - (reflection.source_reflection || reflection).join_table, + reflection.source_reflection.join_table, table_alias_for(reflection, true) ) end diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index e95f77b4d04e3..d3a56c870a8e7 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -269,7 +269,7 @@ def through_reflection end def source_reflection - nil + self end # A chain of reflections from this one back to the owner. For more see the explanation in