As described by DHH in
and similar methods
to create and find the records
matching the specified conditions.
Rails was missing similar feature for
deleting/destroying the record(s).
Before Rails 6, deleting/destroying the record(s) which are matching the given condition was done as shown below.
The above examples were missing
the symmetry like
In Rails 6, the new
methods have been added as
ActiveRecord::Relation#delete_by is short-hand
ActiveRecord::Relation#destroy_by is short-hand
Here is how it can be used.
Check out the pull request for more details on this.