提交 fb898e98 编写于 作者: V Vipul A M

Merge pull request #24859 from y-yagi/do_not_pass_conditon_to_destroy_all

do not pass conditions to `#destroy_all` [ci skip]
......@@ -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
......
......@@ -42,7 +42,7 @@ def each_record
# 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|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册