aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-05-18 10:42:26 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-07-07 05:03:53 +0900
commitd3303c31c23e7fdbd9e523c628c111ef6bea0e74 (patch)
treea4c8b7d0184a0ff79915568246c54bf0ae76c08a /activerecord/test/models
parentc8ce3459648ce0f86646b564ce1c0bb16a4b48eb (diff)
downloadrails-d3303c31c23e7fdbd9e523c628c111ef6bea0e74.tar.gz
rails-d3303c31c23e7fdbd9e523c628c111ef6bea0e74.tar.bz2
rails-d3303c31c23e7fdbd9e523c628c111ef6bea0e74.zip
Add a test case for overwriting existing condition on associations
Overwriting existing condition on associations has already supported (23bcc65 for eager loading, 2bfa2c0 for preloading). Fixes #27724. Closes #29154.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/post.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index ed64e0ee52..ada277f3b2 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -199,6 +199,11 @@ class FirstPost < ActiveRecord::Base
has_one :comment, foreign_key: :post_id
end
+class TaggedPost < Post
+ has_many :taggings, -> { rewhere(taggable_type: "TaggedPost") }, as: :taggable
+ has_many :tags, through: :taggings
+end
+
class PostWithDefaultInclude < ActiveRecord::Base
self.inheritance_column = :disabled
self.table_name = "posts"