1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #24859 from y-yagi/do_not_pass_conditon_to_destroy_all

do not pass conditions to `#destroy_all` [ci skip]
This commit is contained in:
Vipul A M 2016-05-05 07:37:20 -05:00
commit fb898e986f
2 changed files with 3 additions and 3 deletions

View file

@ -54,8 +54,8 @@ module ActiveRecord
#
# class Firm < ActiveRecord::Base
# # Destroys the associated clients and people when the firm is destroyed
# before_destroy { |record| Person.destroy_all "firm_id = #{record.id}" }
# before_destroy { |record| Client.destroy_all "client_of = #{record.id}" }
# before_destroy { |record| Person.where("firm_id = #{record.id}").destroy_all }
# before_destroy { |record| Client.where("client_of = #{record.id}").destroy_all }
# end
#
# == Inheritable callback queues

View file

@ -42,7 +42,7 @@ module ActiveRecord
# Delegates #delete_all, #update_all, #destroy_all methods to each batch.
#
# People.in_batches.delete_all
# People.in_batches.destroy_all('age < 10')
# People.where('age < 10').in_batches.destroy_all
# People.in_batches.update_all('age = age + 1')
[:delete_all, :update_all, :destroy_all].each do |method|
define_method(method) do |*args, &block|