diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-02-18 00:14:54 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-02-18 00:14:54 +0000 |
commit | f2546164d6eb9302d1ff5d36939d128b8f96feb1 (patch) | |
tree | e7f4d7f718686da00e6062d50997e58975c6cf0a /activerecord/test/models | |
parent | 23e58a0552b4febd9372ee4642b0da886d92fd7a (diff) | |
download | rails-f2546164d6eb9302d1ff5d36939d128b8f96feb1.tar.gz rails-f2546164d6eb9302d1ff5d36939d128b8f96feb1.tar.bz2 rails-f2546164d6eb9302d1ff5d36939d128b8f96feb1.zip |
Make dynamic finders respect the :include on HasManyThrough associations. Closes #10998. [cpytel]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/person.rb | 1 | ||||
-rw-r--r-- | activerecord/test/models/post.rb | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index 7a9666f4eb..366f9fb708 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -1,4 +1,5 @@ class Person < ActiveRecord::Base has_many :readers has_many :posts, :through => :readers + has_many :posts_with_no_comments, :through => :readers, :source => :post, :include => :comments, :conditions => 'comments.id is null' end diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index 176a0ddc1e..7f9d53b34b 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -25,7 +25,7 @@ class Post < ActiveRecord::Base has_and_belongs_to_many :special_categories, :join_table => "categories_posts", :association_foreign_key => 'category_id' has_many :taggings, :as => :taggable - has_many :tags, :through => :taggings, :include => :tagging do + has_many :tags, :through => :taggings do def add_joins_and_select find :all, :select => 'tags.*, authors.id as author_id', :include => false, :joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id' |