From d2898d4ef80dc74ef0d6204b5c7f50877659e50e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 19 Oct 2010 17:27:50 -0700 Subject: scopes can take an object that responds to `call` --- activerecord/test/models/topic.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test/models/topic.rb') diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index ba2fe1987b..82d4b5997f 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -18,6 +18,13 @@ class Topic < ActiveRecord::Base 1 end end + + scope :with_object, Class.new(Struct.new(:klass)) { + def call + klass.where(:approved => true) + end + }.new(self) + module NamedExtension def two 2 -- cgit v1.2.3