diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-21 15:08:14 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-21 15:25:09 -0700 |
commit | d7877ffc30f2cce8b6df57e81503c6441c1c9790 (patch) | |
tree | 1a206102a3ab45c839c1766623835efa02ad677d /activerecord/lib/active_record | |
parent | 67a9ae6a66df1a8feaa2b71fa8d55e4feebb7401 (diff) | |
download | rails-d7877ffc30f2cce8b6df57e81503c6441c1c9790.tar.gz rails-d7877ffc30f2cce8b6df57e81503c6441c1c9790.tar.bz2 rails-d7877ffc30f2cce8b6df57e81503c6441c1c9790.zip |
remove some repeated code
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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? |