aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/modules_test.rb
diff options
context:
space:
mode:
authorRich Bradley <richbradley@gmail.com>2009-08-08 23:29:38 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-08-09 00:31:46 -0700
commit9bb8ef9edebf5c27b8a1c67ca3776d52afbc1dc4 (patch)
treefa7154082c74f53d2441407786ce72ecb68903da /activerecord/test/cases/modules_test.rb
parent0d539947017e0ba04601889e2a3e01a64bcadf69 (diff)
downloadrails-9bb8ef9edebf5c27b8a1c67ca3776d52afbc1dc4.tar.gz
rails-9bb8ef9edebf5c27b8a1c67ca3776d52afbc1dc4.tar.bz2
rails-9bb8ef9edebf5c27b8a1c67ca3776d52afbc1dc4.zip
Fix for nested :include with namespaced models.
[#260 state:committed]
Diffstat (limited to 'activerecord/test/cases/modules_test.rb')
-rw-r--r--activerecord/test/cases/modules_test.rb13
1 files changed, 13 insertions, 0 deletions
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