diff options
author | Agis- <corestudiosinc@gmail.com> | 2013-04-06 10:57:46 +0300 |
---|---|---|
committer | Agis- <corestudiosinc@gmail.com> | 2013-04-06 20:34:50 +0300 |
commit | 666a248b0c38ceb93a4dc2da76e28b0cbd7283df (patch) | |
tree | 1f2ca6e74ab30bbc9a13ccd5e09426d77004a4e3 | |
parent | 941986c7db3f4abaed6f859a4d7b93e6445039c4 (diff) | |
download | rails-666a248b0c38ceb93a4dc2da76e28b0cbd7283df.tar.gz rails-666a248b0c38ceb93a4dc2da76e28b0cbd7283df.tar.bz2 rails-666a248b0c38ceb93a4dc2da76e28b0cbd7283df.zip |
Deprecate ActiveRecord#Base.default_scopes?
See #10107.
-rw-r--r-- | activerecord/CHANGELOG.md | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/scoping/default.rb | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 0ab01d6183..5891de9841 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,10 @@ ## Rails 4.0.0 (unreleased) ## +* `#default_scopes?` is deprecated. Instead, do something like + `Post.default_scopes.empty?`. + + *Agis Anastasopoulos* + * Default values for PostgreSQL bigint types now get parsed and dumped to the schema correctly. 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 |