From 9bb8ef9edebf5c27b8a1c67ca3776d52afbc1dc4 Mon Sep 17 00:00:00 2001 From: Rich Bradley Date: Sat, 8 Aug 2009 23:29:38 -0700 Subject: Fix for nested :include with namespaced models. [#260 state:committed] --- activerecord/test/cases/modules_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/modules_test.rb b/activerecord/test/cases/modules_test.rb index 283333fc04..8360416aa2 100644 --- a/activerecord/test/cases/modules_test.rb +++ b/activerecord/test/cases/modules_test.rb @@ -36,4 +36,17 @@ class ModulesTest < ActiveRecord::TestCase assert_equal 'companies', MyApplication::Business::Client.table_name, 'table_name for ActiveRecord model subclass' assert_equal 'company_contacts', MyApplication::Business::Client::Contact.table_name, 'table_name for ActiveRecord model enclosed by another ActiveRecord model' end + + def test_eager_loading_in_modules + # need to add an eager loading condition to force the eager loading model into + # the old join model, to test that. See http://dev.rubyonrails.org/ticket/9640 + client_join_loaded = MyApplication::Business::Client.find(3, :include => {:firm => :account}, :conditions => 'accounts.id IS NOT NULL') + client_sequential_loaded = MyApplication::Business::Client.find(3, :include => {:firm => :account}) + + [client_join_loaded, client_sequential_loaded].each do |client| + assert_no_queries do + assert_not_nil(client.firm.account) + end + end + end end -- cgit v1.2.3