From 7f6872e85bdc2364ed0f90fc9795c59c1deef103 Mon Sep 17 00:00:00 2001 From: Chris Geihsler Date: Sat, 12 Jan 2013 10:22:17 -0500 Subject: Added test case to prevent regression of chained, preloaded scopes. (#7490) --- activerecord/test/models/post.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/test/models') 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 -- cgit v1.2.3