diff options
author | Frederick Cheung <frederick.cheung@gmail.com> | 2008-05-07 00:12:17 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-05-11 22:14:07 +0100 |
commit | 236f0bb67adecbc1e6dac5258e4a8cb310ffd7a4 (patch) | |
tree | aaca136f3ba80f589e24595cd953f064697ef0bb /activerecord/test | |
parent | 0cbdd96c349c56c47299ca3c2bfa5d8c4f5e5a11 (diff) | |
download | rails-236f0bb67adecbc1e6dac5258e4a8cb310ffd7a4.tar.gz rails-236f0bb67adecbc1e6dac5258e4a8cb310ffd7a4.tar.bz2 rails-236f0bb67adecbc1e6dac5258e4a8cb310ffd7a4.zip |
When preloading group by reflection rather than by class [#125 state:resolved]
This avoids extra queries when several subclasses inherit the association
from their parent class, while still coping with subclasses redefining
associations.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index fb8deedf95..3a3358e39b 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -603,4 +603,10 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal 3, authors(:david).posts_with_comments.count(:conditions => "length(comments.body) > 15") end end + + def test_load_with_sti_sharing_association + assert_queries(2) do #should not do 1 query per subclass + Comment.find :all, :include => :post + end + end end |