aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-05 09:51:09 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-05 09:51:09 -0800
commit8bdc191994bb091310cbbe4690900e7a97da0b5e (patch)
treeba56c9bedb9ece9d5290477e60c9c77e18cd72a0 /activerecord/lib
parente468a62dc89d4d3c2a16a6d3e8fd78342a2732df (diff)
downloadrails-8bdc191994bb091310cbbe4690900e7a97da0b5e.tar.gz
rails-8bdc191994bb091310cbbe4690900e7a97da0b5e.tar.bz2
rails-8bdc191994bb091310cbbe4690900e7a97da0b5e.zip
we have a method for this, so let's use it
Diffstat (limited to 'activerecord/lib')
-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 a8e1ea21c4..3c939d7e85 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
@@ -29,7 +29,7 @@ module ActiveRecord
if @reflection.options[:insert_sql]
@owner.connection.insert(interpolate_sql(@reflection.options[:insert_sql], record))
else
- relation = Arel::Table.new(@reflection.options[:join_table])
+ relation = join_table
timestamps = record_timestamp_columns(record)
timezone = record.send(:current_time_from_proper_timezone) if timestamps.any?
@@ -59,7 +59,7 @@ module ActiveRecord
if sql = @reflection.options[:delete_sql]
records.each { |record| @owner.connection.delete(interpolate_sql(sql, record)) }
else
- relation = Arel::Table.new(@reflection.options[:join_table])
+ relation = join_table
stmt = relation.where(relation[@reflection.foreign_key].eq(@owner.id).
and(relation[@reflection.association_foreign_key].in(records.map { |x| x.id }.compact))
).compile_delete