aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
diff options
context:
space:
mode:
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.rb4
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 39a6a7ed5f..9183445d74 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
@@ -122,7 +122,7 @@ module ActiveRecord
when @association_foreign_key
attributes[column.name] = record.quoted_id
else
- value = record[column.name]
+ value = @owner.send(:quote, record[column.name], column)
attributes[column.name] = value unless value.nil?
end
attributes
@@ -130,7 +130,7 @@ module ActiveRecord
sql =
"INSERT INTO #{@join_table} (#{@owner.send(:quoted_column_names, attributes).join(', ')}) " +
- "VALUES (#{attributes.values.collect { |value| @owner.send(:quote, value) }.join(', ')})"
+ "VALUES (#{attributes.values.join(', ')})"
@owner.connection.execute(sql)
end