diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-21 16:50:22 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-21 16:50:22 -0700 |
commit | 31eb76564068aa8750cec050906a3739fa1f56a6 (patch) | |
tree | 8cfcd8802dd5211f7d3f1012d27496bcb40ff8d4 | |
parent | 50041e563a6a6e7ebe234c542935fb6fce4935e8 (diff) | |
download | rails-31eb76564068aa8750cec050906a3739fa1f56a6.tar.gz rails-31eb76564068aa8750cec050906a3739fa1f56a6.tar.bz2 rails-31eb76564068aa8750cec050906a3739fa1f56a6.zip |
refacoring duplicate code. <3 <3 <3
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 5 |
1 files changed, 3 insertions, 2 deletions
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 |