aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2016-05-05 07:37:20 -0500
committerVipul A M <vipulnsward@gmail.com>2016-05-05 07:37:20 -0500
commitfb898e986f8da1943e293e9c42d8c2e1aa4525d6 (patch)
tree3d3611a6ed6e18300fda923baf1826063decbe2f /activerecord
parentb8de57411227b79f17181deb88f5a32175777083 (diff)
parentc16a4ca397fa1a61ba1b5481f232d66aad2c3a56 (diff)
downloadrails-fb898e986f8da1943e293e9c42d8c2e1aa4525d6.tar.gz
rails-fb898e986f8da1943e293e9c42d8c2e1aa4525d6.tar.bz2
rails-fb898e986f8da1943e293e9c42d8c2e1aa4525d6.zip
Merge pull request #24859 from y-yagi/do_not_pass_conditon_to_destroy_all
do not pass conditions to `#destroy_all` [ci skip]
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/callbacks.rb4
-rw-r--r--activerecord/lib/active_record/relation/batches/batch_enumerator.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb
index 1f1b11eb68..7c4f1b2bb3 100644
--- a/activerecord/lib/active_record/callbacks.rb
+++ b/activerecord/lib/active_record/callbacks.rb
@@ -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
diff --git a/activerecord/lib/active_record/relation/batches/batch_enumerator.rb b/activerecord/lib/active_record/relation/batches/batch_enumerator.rb
index 13393dc605..333b3a63cf 100644
--- a/activerecord/lib/active_record/relation/batches/batch_enumerator.rb
+++ b/activerecord/lib/active_record/relation/batches/batch_enumerator.rb
@@ -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|