aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-05-24 15:34:28 -0700
committerJon Leighton <j@jonathanleighton.com>2011-05-24 15:34:28 -0700
commitce37f747cd37a480025fbe69c3b1e44cb6a6e3af (patch)
tree964e684400b32788cf620958702ab1d2e56a9a10 /activerecord/test/models
parenta000ff7a503158cc95bee9cd4b15ff9089f6828a (diff)
parentd8bd19f6abd1f8cb344ff5c77971a357c4f5b3ec (diff)
downloadrails-ce37f747cd37a480025fbe69c3b1e44cb6a6e3af.tar.gz
rails-ce37f747cd37a480025fbe69c3b1e44cb6a6e3af.tar.bz2
rails-ce37f747cd37a480025fbe69c3b1e44cb6a6e3af.zip
Merge pull request #1254 from pixeltrix/ignore-includes-in-through-scope
Ignore :includes on through associations
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/author.rb3
-rw-r--r--activerecord/test/models/post.rb6
2 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index e0cbc44265..23db5650d4 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -138,6 +138,9 @@ class Author < ActiveRecord::Base
has_many :misc_post_first_blue_tags_2, :through => :posts, :source => :first_blue_tags_2,
:conditions => { :posts => { :title => ['misc post by bob', 'misc post by mary'] } }
+ has_many :posts_with_default_include, :class_name => 'PostWithDefaultInclude'
+ has_many :comments_on_posts_with_default_include, :through => :posts_with_default_include, :source => :comments
+
scope :relation_include_posts, includes(:posts)
scope :relation_include_tags, includes(:tags)
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 80296032bb..f2ab7b053e 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -162,3 +162,9 @@ class FirstPost < ActiveRecord::Base
has_many :comments, :foreign_key => :post_id
has_one :comment, :foreign_key => :post_id
end
+
+class PostWithDefaultInclude < ActiveRecord::Base
+ self.table_name = 'posts'
+ default_scope includes(:comments)
+ has_many :comments, :foreign_key => :post_id
+end \ No newline at end of file