diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-10 15:49:49 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-10 15:49:49 +0000 |
commit | fdd268138a062b45aa126c21ee3d5579f01c3f2e (patch) | |
tree | 28c593bd479bb8be02e4b028a8c0e1bc4fe638dd /activerecord/lib/active_record | |
parent | 2119e0699a182575349b1c3a311b182e171e097c (diff) | |
download | rails-fdd268138a062b45aa126c21ee3d5579f01c3f2e.tar.gz rails-fdd268138a062b45aa126c21ee3d5579f01c3f2e.tar.bz2 rails-fdd268138a062b45aa126c21ee3d5579f01c3f2e.zip |
Made eager loading work with inheritance hierarchies #1065 [Ryan Carver]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1131 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c27bcecdd6..3a1a590be8 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -732,9 +732,11 @@ module ActiveRecord #:nodoc: end def type_condition - " (" + subclasses.inject("#{inheritance_column} = '#{Inflector.demodulize(name)}' ") do |condition, subclass| - condition << "OR #{inheritance_column} = '#{Inflector.demodulize(subclass.name)}' " - end + ") " + type_condition = subclasses.inject("#{table_name}.#{inheritance_column} = '#{name.demodulize}' ") do |condition, subclass| + condition << "OR #{table_name}.#{inheritance_column} = '#{subclass.name.demodulize}' " + end + + return " (#{type_condition})" end # Guesses the table name, but does not decorate it with prefix and suffix information. |