diff options
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.rb | 4 |
1 files changed, 2 insertions, 2 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 15211c2223..f827cf3282 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 @@ -136,7 +136,7 @@ module ActiveRecord def delete_records(records) if sql = @options[:delete_sql] - records.each { |record| @owner.connection.execute(sql) } + records.each { |record| @owner.connection.execute(interpolate_sql(sql, record)) } else ids = quoted_record_ids(records) sql = "DELETE FROM #{@join_table} WHERE #{@association_class_primary_key_name} = #{@owner.quoted_id} AND #{@association_foreign_key} IN (#{ids})" @@ -145,7 +145,7 @@ module ActiveRecord end def construct_sql - interpolate_sql_options!(@options, :finder_sql, :delete_sql) + interpolate_sql_options!(@options, :finder_sql) if @options[:finder_sql] @finder_sql = @options[:finder_sql] |