diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-12-29 15:55:31 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-12-29 17:53:04 -0500 |
commit | d31a6d1384cd740c8518d0bf695b550d2a3a4e9b (patch) | |
tree | ebf38289a80e15c1263ed54f1b9cc8ebb6f931d9 | |
parent | 4fc3366d9d99a0eb19e45ad2bf38534efbf8c8ce (diff) | |
download | rails-d31a6d1384cd740c8518d0bf695b550d2a3a4e9b.tar.gz rails-d31a6d1384cd740c8518d0bf695b550d2a3a4e9b.tar.bz2 rails-d31a6d1384cd740c8518d0bf695b550d2a3a4e9b.zip |
Remove deprecated conditions parameter from `#destroy_all`
-rw-r--r-- | activerecord/CHANGELOG.md | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 12 | ||||
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 6 |
3 files changed, 6 insertions, 16 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index ae7587e8d1..39995c51be 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Remove deprecated conditions parameter from `#destroy_all`. + + *Rafael Mendonça França* + * Remove deprecated support to passing arguments to `#select` when a block is provided. *Rafael Mendonça França* diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 4e941cf2df..9a1312b883 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -446,16 +446,8 @@ module ActiveRecord # ==== Examples # # Person.where(age: 0..18).destroy_all - def destroy_all(conditions = nil) - if conditions - ActiveSupport::Deprecation.warn(<<-MESSAGE.squish) - Passing conditions to destroy_all is deprecated and will be removed in Rails 5.1. - To achieve the same use where(conditions).destroy_all. - MESSAGE - where(conditions).destroy_all - else - records.each(&:destroy).tap { reset } - end + def destroy_all + records.each(&:destroy).tap { reset } end # Destroy an object (or multiple objects) that has the given id. The object is instantiated first, diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 2421adb19c..b91d6ba673 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1004,12 +1004,6 @@ class RelationTest < ActiveRecord::TestCase assert davids.loaded? end - def test_destroy_all_with_conditions_is_deprecated - assert_deprecated do - assert_difference("Author.count", -1) { Author.destroy_all(name: "David") } - end - end - def test_delete_all davids = Author.where(name: "David") |