From 31eb76564068aa8750cec050906a3739fa1f56a6 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 21 Sep 2010 16:50:22 -0700 Subject: refacoring duplicate code. <3 <3 <3 --- activerecord/lib/active_record/associations.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 79f8ce346d..ff1a3f47b7 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -2213,8 +2213,9 @@ module ActiveRecord first_key = second_key = nil if through_reflection.options[:as] # has_many :through against a polymorphic join - jt_foreign_key = through_reflection.options[:as].to_s + '_id' - jt_as_extra = join_table[through_reflection.options[:as].to_s + '_type'].eq(parent.active_record.base_class.name) + as_key = through_reflection.options[:as].to_s + jt_foreign_key = as_key + '_id' + jt_as_extra = join_table[as_key + '_type'].eq(parent.active_record.base_class.name) else jt_foreign_key = through_reflection.primary_key_name end -- cgit v1.2.3