aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-11-21 03:30:06 +0100
committerXavier Noria <fxn@hashref.com>2010-11-21 03:30:06 +0100
commit6af08ab6d835d1c2aa8648a0d3a4a86e678c3f52 (patch)
tree96bd668692b62d3829322232877b70c9011ce446 /activerecord/lib/active_record/named_scope.rb
parentf326221c701e4f9d991e3eadcc793a73795fb218 (diff)
parent7c51d1fcf9dc504c2dfd6e7184bbe8186f09819d (diff)
downloadrails-6af08ab6d835d1c2aa8648a0d3a4a86e678c3f52.tar.gz
rails-6af08ab6d835d1c2aa8648a0d3a4a86e678c3f52.tar.bz2
rails-6af08ab6d835d1c2aa8648a0d3a4a86e678c3f52.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r--activerecord/lib/active_record/named_scope.rb10
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>.
#