diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-19 17:27:50 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-19 17:29:25 -0700 |
commit | d2898d4ef80dc74ef0d6204b5c7f50877659e50e (patch) | |
tree | 1b1744f416f4ec6030833a573a966ca1ada58e5b /activerecord/test/models | |
parent | 56be4c897ae52d73583c51dec155e6161e3dc900 (diff) | |
download | rails-d2898d4ef80dc74ef0d6204b5c7f50877659e50e.tar.gz rails-d2898d4ef80dc74ef0d6204b5c7f50877659e50e.tar.bz2 rails-d2898d4ef80dc74ef0d6204b5c7f50877659e50e.zip |
scopes can take an object that responds to `call`
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/topic.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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 |