Rails has provided methods like
find_or_create_by to fetch, initialize, and create record respectivley,
based on the passed conditions.
Similar method to delete or destroy records was missing in Rails.
As per this issue,
Rails 6 has introduced two methods
ActiveRecord::Relation, which deletes or destroys all the records
that match the passed conditions.
Before Rails 6:
Deleting or destroying records was executed as shown below:
In Rails 6:
Rails 6 now provides convenience methods to achieve the same. The above examples can now be achieved similary like:
The PR for this issue can be referred here.