Skip to content

Commit d31a6d1

Browse files
committed
Remove deprecated conditions parameter from #destroy_all
1 parent 4fc3366 commit d31a6d1

3 files changed

Lines changed: 6 additions & 16 deletions

File tree

activerecord/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated conditions parameter from `#destroy_all`.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated support to passing arguments to `#select` when a block is provided.
26

37
*Rafael Mendonça França*

activerecord/lib/active_record/relation.rb

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -446,16 +446,8 @@ def update(id = :all, attributes)
446446
# ==== Examples
447447
#
448448
# Person.where(age: 0..18).destroy_all
449-
def destroy_all(conditions = nil)
450-
if conditions
451-
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
452-
Passing conditions to destroy_all is deprecated and will be removed in Rails 5.1.
453-
To achieve the same use where(conditions).destroy_all.
454-
MESSAGE
455-
where(conditions).destroy_all
456-
else
457-
records.each(&:destroy).tap { reset }
458-
end
449+
def destroy_all
450+
records.each(&:destroy).tap { reset }
459451
end
460452

461453
# Destroy an object (or multiple objects) that has the given id. The object is instantiated first,

activerecord/test/cases/relations_test.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,6 @@ def test_destroy_all
10041004
assert davids.loaded?
10051005
end
10061006

1007-
def test_destroy_all_with_conditions_is_deprecated
1008-
assert_deprecated do
1009-
assert_difference("Author.count", -1) { Author.destroy_all(name: "David") }
1010-
end
1011-
end
1012-
10131007
def test_delete_all
10141008
davids = Author.where(name: "David")
10151009

0 commit comments

Comments
 (0)