aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-20 16:58:41 -0800
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-20 16:58:41 -0800
commit2e8b3d5c9a7725911ee16d62b9f72edbaea87adb (patch)
tree4c94de91bb95bc9fa21266c7b871ce383887d46a /activerecord/test/models
parent9a7411a92b52022f881280d953a77c424b0f9a78 (diff)
parent7f6872e85bdc2364ed0f90fc9795c59c1deef103 (diff)
downloadrails-2e8b3d5c9a7725911ee16d62b9f72edbaea87adb.tar.gz
rails-2e8b3d5c9a7725911ee16d62b9f72edbaea87adb.tar.bz2
rails-2e8b3d5c9a7725911ee16d62b9f72edbaea87adb.zip
Merge pull request #8913 from seejee/regression_test_for_chained_preloaded_scopes
Added test case to prevent regression of chained, preloaded scopes.
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 4433550dd5..603f1f2555 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -35,6 +35,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