From 666a248b0c38ceb93a4dc2da76e28b0cbd7283df Mon Sep 17 00:00:00 2001 From: Agis- Date: Sat, 6 Apr 2013 10:57:46 +0300 Subject: Deprecate ActiveRecord#Base.default_scopes? See #10107. --- activerecord/lib/active_record/scoping/default.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/scoping') diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb index cde4f29d08..8a90528ce8 100644 --- a/activerecord/lib/active_record/scoping/default.rb +++ b/activerecord/lib/active_record/scoping/default.rb @@ -5,8 +5,17 @@ module ActiveRecord included do # Stores the default scope for the class. - class_attribute :default_scopes, instance_writer: false + class_attribute :default_scopes, instance_writer: false, instance_predicate: false + self.default_scopes = [] + + def self.default_scopes? + ActiveSupport::Deprecation.warn( + "#default_scopes? is deprecated. Do something like #default_scopes.empty? instead." + ) + + !!self.default_scopes + end end module ClassMethods -- cgit v1.2.3