From 1b187caaa1e1aa1bd0f440052b4df09a5ddaa4bf Mon Sep 17 00:00:00 2001 From: Jefferson Lai Date: Tue, 1 Apr 2014 20:18:16 -0700 Subject: CollectionProxy uses the arel of its association's scope. CollectionProxy should be able to reuse the behavior (methods) of its parent class, but with its own state. This change allows CollectionProxy to use the arel object corresponding to its association's scope. --- activerecord/test/models/post.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index faf539a562..099e039255 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -149,6 +149,10 @@ class Post < ActiveRecord::Base ranked_by_comments.limit_by(limit) end + def self.written_by(author) + where(id: author.posts.pluck(:id)) + end + def self.reset_log @log = [] end -- cgit v1.2.3