diff options
author | Yves Senn <yves.senn@gmail.com> | 2016-03-03 16:49:31 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2016-03-03 16:52:35 +0100 |
commit | cd73632d9d47752013f46e775e59241215cfd8e9 (patch) | |
tree | abe436e4af39fc0461191b9190b7f88e36625433 /activerecord/test/cases/associations | |
parent | ba438dbfaed4d6bc62ffc519993770753eb74259 (diff) | |
download | rails-cd73632d9d47752013f46e775e59241215cfd8e9.tar.gz rails-cd73632d9d47752013f46e775e59241215cfd8e9.tar.bz2 rails-cd73632d9d47752013f46e775e59241215cfd8e9.zip |
don't treat all associations with extensions as instance dependent.
Closes #23934.
This is a forward port of ac832a43b4d026dbad28fed196d2de69ec9928ac
Previously the scope of all associations with extensions were wrapped in
an instance dependent proc. This made it impossible to preload such
associations.
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 3ee84fb66c..7f2a2229ee 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -1392,6 +1392,18 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal('10 was not recognized for preload', exception.message) end + test "associations with extensions are not instance dependent" do + assert_nothing_raised do + Author.includes(:posts_with_extension).to_a + end + end + + test "including associations with extensions and an instance dependent scope is not supported" do + e = assert_raises(ArgumentError) do + Author.includes(:posts_with_extension_and_instance).to_a + end + assert_match(/Preloading instance dependent scopes is not supported/, e.message) + end test "preloading readonly association" do # has-one |