aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorChris Geihsler <chris@geihsler.net>2013-01-12 10:22:17 -0500
committerChris Geihsler <chris@geihsler.net>2013-01-19 18:53:25 -0500
commit7f6872e85bdc2364ed0f90fc9795c59c1deef103 (patch)
treebbf1269dbd34189852c2b4a3d81d5cbf0463feab /activerecord/test/models
parent6581d798e830a7820dd54fe95d40014c0e2057fe (diff)
downloadrails-7f6872e85bdc2364ed0f90fc9795c59c1deef103.tar.gz
rails-7f6872e85bdc2364ed0f90fc9795c59c1deef103.tar.bz2
rails-7f6872e85bdc2364ed0f90fc9795c59c1deef103.zip
Added test case to prevent regression of chained, preloaded scopes. (#7490)
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/post.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index c995f59a15..11ce345f7c 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -29,6 +29,9 @@ class Post < ActiveRecord::Base
scope :with_very_special_comments, -> { joins(:comments).where(:comments => {:type => 'VerySpecialComment'}) }
scope :with_post, ->(post_id) { joins(:comments).where(:comments => { :post_id => post_id }) }
+ scope :with_comments, -> { preload(:comments) }
+ scope :with_tags, -> { preload(:taggings) }
+
has_many :comments do
def find_most_recent
order("id DESC").first