From d7877ffc30f2cce8b6df57e81503c6441c1c9790 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 21 Sep 2010 15:08:14 -0700 Subject: remove some repeated code --- activerecord/lib/active_record/associations.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 19c80ffdfd..52383bfe9a 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -2221,13 +2221,13 @@ module ActiveRecord case source_reflection.macro when :has_many + second_key = options[:foreign_key] || primary_key + if source_reflection.options[:as] first_key = "#{source_reflection.options[:as]}_id" - second_key = options[:foreign_key] || primary_key as_extra = aliased_table["#{source_reflection.options[:as]}_type"].eq(source_reflection.active_record.base_class.name) else first_key = through_reflection.klass.base_class.to_s.foreign_key - second_key = options[:foreign_key] || primary_key end unless through_reflection.klass.descends_from_active_record? -- cgit v1.2.3