aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-02-19 21:47:22 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-02-19 21:52:49 +0900
commit64ef5e2f9e854a7f988227d629a699f11a998b17 (patch)
treeef239f8f8df88a6d200c94385f17fdb95681dac9 /activerecord/CHANGELOG.md
parent30016df82f892f621c4937f3aec397f8d4cb30f2 (diff)
parent5c8d4c3466cbfa850a89f718ec358ed3a352c34e (diff)
downloadrails-64ef5e2f9e854a7f988227d629a699f11a998b17.tar.gz
rails-64ef5e2f9e854a7f988227d629a699f11a998b17.tar.bz2
rails-64ef5e2f9e854a7f988227d629a699f11a998b17.zip
Merge pull request #35316 from abhaynikam/35304-add-delete_by_and_destroy_by
Introduce delete_by and destroy_by methods to ActiveRecord::Relation
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.