aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/eager_test.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2012-12-02 21:24:47 +0100
committerYves Senn <yves.senn@garaio.com>2012-12-04 13:35:49 +0100
commit1b961765871eba76d50d463d3af6c3c5926f537a (patch)
treee45ee0a495f7f351e6f3d7822b62ab209e34132e /activerecord/test/cases/associations/eager_test.rb
parentdac811e8542ee7b9abb88a5839fa22dd59c7c737 (diff)
downloadrails-1b961765871eba76d50d463d3af6c3c5926f537a.tar.gz
rails-1b961765871eba76d50d463d3af6c3c5926f537a.tar.bz2
rails-1b961765871eba76d50d463d3af6c3c5926f537a.zip
backport #8403, no intermediate AR objects when eager loading.
Closes #3313 Conflicts: activerecord/CHANGELOG.md activerecord/test/models/developer.rb
Diffstat (limited to 'activerecord/test/cases/associations/eager_test.rb')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb6
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 bf01b46852..d3601e0dba 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -916,6 +916,12 @@ class EagerAssociationTest < ActiveRecord::TestCase
assert_equal 3, Developer.find(:all, :include => 'projects', :conditions => 'developers_projects.access_level = 1', :limit => 5).size
end
+ def test_dont_create_temporary_active_record_instances
+ Developer.instance_count = 0
+ developers = Developer.find(:all, :include => 'projects', :conditions => '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.find(:all, :include => 'projects', :order => 'developers_projects.joined_on DESC', :limit => 5).size
end