diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-10-15 16:37:11 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-10-15 16:37:11 +0000 |
commit | cdb5132c411db0a330e85ec9d2eb7fe543af7aff (patch) | |
tree | 92114f1a60fc65e8b3f9a4bc5d7ab60a6f4b47e4 /activerecord/test/fixtures/author.rb | |
parent | 39963b4b9df7f6c3e7d29c91dfdd1e8279f51e60 (diff) | |
download | rails-cdb5132c411db0a330e85ec9d2eb7fe543af7aff.tar.gz rails-cdb5132c411db0a330e85ec9d2eb7fe543af7aff.tar.bz2 rails-cdb5132c411db0a330e85ec9d2eb7fe543af7aff.zip |
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
Diffstat (limited to 'activerecord/test/fixtures/author.rb')
-rw-r--r-- | activerecord/test/fixtures/author.rb | 10 |
1 files changed, 9 insertions, 1 deletions
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, |