diff options
author | Yves Senn <yves.senn@gmail.com> | 2012-12-02 21:24:47 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@garaio.com> | 2012-12-04 11:52:08 +0100 |
commit | db51704bd9458635ad82e6a7de56a9fd56db64d4 (patch) | |
tree | f7e3cf4d528c38145c0e547fd345d2d19823fa6c /activerecord/test/cases | |
parent | c7e4ee79326d81f78cfa3d958a8fce34fde83a15 (diff) | |
download | rails-db51704bd9458635ad82e6a7de56a9fd56db64d4.tar.gz rails-db51704bd9458635ad82e6a7de56a9fd56db64d4.tar.bz2 rails-db51704bd9458635ad82e6a7de56a9fd56db64d4.zip |
Do not instantiate intermediate AR objects when eager loading.
Closes #3313
Diffstat (limited to 'activerecord/test/cases')
-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 79612c8dee..94437380a4 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -944,6 +944,12 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal 3, Developer.all.merge!(:includes => 'projects', :where => { 'developers_projects.access_level' => 1 }, :limit => 5).to_a.size end + def test_dont_create_temporary_active_record_instances + Developer.instance_count = 0 + developers = Developer.all.merge!(:includes => 'projects', :where => { 'developers_projects.access_level' => 1 }, :limit => 5).to_a + assert_equal developers.count, Developer.instance_count + end + def test_order_on_join_table_with_include_and_limit assert_equal 5, Developer.all.merge!(:includes => 'projects', :order => 'developers_projects.joined_on DESC', :limit => 5).to_a.size end |