aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/topic.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-04-08 23:54:54 +0100
committerAaron Patterson <aaron.patterson@gmail.com>2011-04-12 19:46:05 -0700
commitf0e198bfa1e3f9689e0cde1d194a44027fc90b3c (patch)
tree2da93eee8e63c088350971c04b80cd673f1b5333 /activerecord/test/models/topic.rb
parent788bd30859f3f21184defd240c3d32f179515225 (diff)
downloadrails-f0e198bfa1e3f9689e0cde1d194a44027fc90b3c.tar.gz
rails-f0e198bfa1e3f9689e0cde1d194a44027fc90b3c.tar.bz2
rails-f0e198bfa1e3f9689e0cde1d194a44027fc90b3c.zip
Deprecate defining scopes with a callable (lambda, proc, etc) via the scope class method. Just define a class method yourself instead.
Diffstat (limited to 'activerecord/test/models/topic.rb')
-rw-r--r--activerecord/test/models/topic.rb26
1 files changed, 15 insertions, 11 deletions
diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb
index 6440dbe8ab..60e750e6c4 100644
--- a/activerecord/test/models/topic.rb
+++ b/activerecord/test/models/topic.rb
@@ -1,10 +1,20 @@
class Topic < ActiveRecord::Base
scope :base
- scope :written_before, lambda { |time|
- if time
- { :conditions => ['written_on < ?', time] }
- end
- }
+
+ ActiveSupport::Deprecation.silence do
+ scope :written_before, lambda { |time|
+ if time
+ { :conditions => ['written_on < ?', time] }
+ end
+ }
+
+ scope :with_object, Class.new(Struct.new(:klass)) {
+ def call
+ klass.where(:approved => true)
+ end
+ }.new(self)
+ end
+
scope :approved, :conditions => {:approved => true}
scope :rejected, :conditions => {:approved => false}
@@ -19,12 +29,6 @@ class Topic < ActiveRecord::Base
end
end
- scope :with_object, Class.new(Struct.new(:klass)) {
- def call
- klass.where(:approved => true)
- end
- }.new(self)
-
module NamedExtension
def two
2