From cdb5132c411db0a330e85ec9d2eb7fe543af7aff Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Sun, 15 Oct 2006 16:37:11 +0000 Subject: Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes #5783. [Jonathan Viney] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5305 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/fixtures/author.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/author.rb b/activerecord/test/fixtures/author.rb index 7373639383..6b34c7522c 100644 --- a/activerecord/test/fixtures/author.rb +++ b/activerecord/test/fixtures/author.rb @@ -17,7 +17,15 @@ class Author < ActiveRecord::Base has_many :comments, :through => :posts has_many :funky_comments, :through => :posts, :source => :comments - has_many :special_posts, :class_name => "Post" + has_many :special_posts + has_many :special_post_comments, :through => :special_posts, :source => :comments + + has_many :special_nonexistant_posts, :class_name => "SpecialPost", :conditions => "posts.body = 'nonexistant'" + has_many :special_nonexistant_post_comments, :through => :special_nonexistant_posts, :source => :comments, :conditions => "comments.post_id = 0" + + has_many :hello_posts, :class_name => "Post", :conditions => "posts.body = 'hello'" + has_many :hello_post_comments, :through => :hello_posts, :source => :comments + has_many :other_posts, :class_name => "Post" has_many :posts_with_callbacks, :class_name => "Post", :before_add => :log_before_adding, :after_add => :log_after_adding, -- cgit v1.2.3