diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-04-06 10:44:30 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-04-06 10:44:30 -0700 |
commit | a9da54988f11bf79e7df2275397aca468092ea05 (patch) | |
tree | 1f2ca6e74ab30bbc9a13ccd5e09426d77004a4e3 /activerecord | |
parent | ec8f59ca530316a14672686611c629abc4112950 (diff) | |
parent | 666a248b0c38ceb93a4dc2da76e28b0cbd7283df (diff) | |
download | rails-a9da54988f11bf79e7df2275397aca468092ea05.tar.gz rails-a9da54988f11bf79e7df2275397aca468092ea05.tar.bz2 rails-a9da54988f11bf79e7df2275397aca468092ea05.zip |
Merge pull request #10113 from Agis-/default_scopes_predicate
Deprecate ActiveRecord#Base.default_scopes?
Closes #10107
Diffstat (limited to 'activerecord')
-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 |