diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2010-11-19 18:29:33 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-20 19:40:29 +0100 |
commit | d7db6a88734c3b666f4b85f266d223eff408b294 (patch) | |
tree | ccfa0ed1a0e92b9c3324bf92f92391f2d20be95c /activerecord/lib/active_record/named_scope.rb | |
parent | 8d8062190ddd0452088f6ea917267ed993a70990 (diff) | |
download | rails-d7db6a88734c3b666f4b85f266d223eff408b294.tar.gz rails-d7db6a88734c3b666f4b85f266d223eff408b294.tar.bz2 rails-d7db6a88734c3b666f4b85f266d223eff408b294.zip |
class inheritable attributes is used no more! all internal use of class inheritable has been changed to class_attribute. class inheritable attributes has been deprecated.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r-- | activerecord/lib/active_record/named_scope.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb index 0b92ba5caa..0f421560f0 100644 --- a/activerecord/lib/active_record/named_scope.rb +++ b/activerecord/lib/active_record/named_scope.rb @@ -2,12 +2,18 @@ require 'active_support/core_ext/array' require 'active_support/core_ext/hash/except' require 'active_support/core_ext/kernel/singleton_class' require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/class/attribute' module ActiveRecord # = Active Record Named \Scopes module NamedScope extend ActiveSupport::Concern + included do + class_attribute :scopes + self.scopes = {} + end + module ClassMethods # Returns an anonymous \scope. # @@ -33,10 +39,6 @@ module ActiveRecord end end - def scopes - read_inheritable_attribute(:scopes) || write_inheritable_attribute(:scopes, {}) - end - # Adds a class method for retrieving and querying objects. A \scope represents a narrowing of a database query, # such as <tt>where(:color => :red).select('shirts.*').includes(:washing_instructions)</tt>. # |