aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-12-02 13:53:59 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-02 14:02:52 -0800
commit15633519f7fbe5450e4b232e556deca3340eb88d (patch)
tree93f42ea5e9a8ee52dbfc8660905a8a6158dc2df8 /activerecord
parentacbabd96268237826e1ab094273a1d7d53b4e579 (diff)
downloadrails-15633519f7fbe5450e4b232e556deca3340eb88d.tar.gz
rails-15633519f7fbe5450e4b232e556deca3340eb88d.tar.bz2
rails-15633519f7fbe5450e4b232e556deca3340eb88d.zip
removing some calls to insert on arel
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb7
1 files changed, 4 insertions, 3 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 f6f291a039..367104ec1b 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
@@ -49,7 +49,7 @@ module ActiveRecord
timestamps = record_timestamp_columns(record)
timezone = record.send(:current_time_from_proper_timezone) if timestamps.any?
- attributes = Hash[columns.map do |column|
+ attributes = columns.map do |column|
name = column.name
value = case name.to_s
when @reflection.primary_key_name.to_s
@@ -62,9 +62,10 @@ module ActiveRecord
@owner.send(:quote_value, record[name], column) if record.has_attribute?(name)
end
[relation[name], value] unless value.nil?
- end]
+ end
- relation.insert(attributes)
+ stmt = relation.compile_insert Hash[attributes]
+ @owner.connection.insert stmt.to_sql
end
true