aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2016-03-03 16:49:31 +0100
committerYves Senn <yves.senn@gmail.com>2016-03-03 16:52:35 +0100
commitcd73632d9d47752013f46e775e59241215cfd8e9 (patch)
treeabe436e4af39fc0461191b9190b7f88e36625433 /activerecord/test/models
parentba438dbfaed4d6bc62ffc519993770753eb74259 (diff)
downloadrails-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/models')
-rw-r--r--activerecord/test/models/author.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index f25e31b13d..38b983eda0 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -144,6 +144,14 @@ class Author < ActiveRecord::Base
has_many :posts_with_signature, ->(record) { where("posts.title LIKE ?", "%by #{record.name.downcase}%") }, class_name: "Post"
+ has_many :posts_with_extension, -> { order(:title) }, class_name: "Post" do
+ def extension_method; end
+ end
+
+ has_many :posts_with_extension_and_instance, ->(record) { order(:title) }, class_name: "Post" do
+ def extension_method; end
+ end
+
attr_accessor :post_log
after_initialize :set_post_log