aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index c1ce01c312..8f626156a2 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,29 @@
+* Introduce `ActiveRecord::Relation#destroy_by` and `ActiveRecord::Relation#delete_by`.
+
+ `destroy_by` allows relation to find all the records matching the condition and perform
+ `destroy_all` on the matched records.
+
+ Example:
+
+ Person.destroy_by(name: 'David')
+ Person.destroy_by(name: 'David', rating: 4)
+
+ david = Person.find_by(name: 'David')
+ david.posts.destroy_by(id: [1, 2, 3])
+
+ `delete_by` allows relation to find all the records matching the condition and perform
+ `delete_all` on the matched records.
+
+ Example:
+
+ Person.delete_by(name: 'David')
+ Person.delete_by(name: 'David', rating: 4)
+
+ david = Person.find_by(name: 'David')
+ david.posts.delete_by(id: [1, 2, 3])
+
+ *Abhay Nikam*
+
* Don't allow `where` with invalid value matches to nil values.
Fixes #33624.