aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-05-18 21:11:34 +0100
committerJon Leighton <j@jonathanleighton.com>2012-05-18 21:11:47 +0100
commit855fabca669f1a57c70bfa7bfc396495018e4a5c (patch)
treee0262c332a74e170999e76581ec8ff383d8aba63 /activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
parentb98d1e21635d8776de8893cc09bd86c71f6c78f0 (diff)
downloadrails-855fabca669f1a57c70bfa7bfc396495018e4a5c.tar.gz
rails-855fabca669f1a57c70bfa7bfc396495018e4a5c.tar.bz2
rails-855fabca669f1a57c70bfa7bfc396495018e4a5c.zip
fix #delete_all with habtm with :delete_sql
Diffstat (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
index e8ae3e51b9..1048c0b12e 100644
--- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -44,6 +44,7 @@ module ActiveRecord
def delete_records(records, method)
if sql = options[:delete_sql]
+ records = load_target if records == :all
records.each { |record| owner.connection.delete(interpolate(sql, record)) }
else
relation = join_table