diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-02 14:49:02 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-02 15:07:00 -0800 |
commit | ead0c6eed35c71cc990f8c5b6d98e20c6072c136 (patch) | |
tree | a18f2c3d918c65f3712f9962c52f8658cd750033 /activerecord/lib/active_record/associations | |
parent | 12b9920a15d93ead97bad83c30fd3a15bc7b074a (diff) | |
download | rails-ead0c6eed35c71cc990f8c5b6d98e20c6072c136.tar.gz rails-ead0c6eed35c71cc990f8c5b6d98e20c6072c136.tar.bz2 rails-ead0c6eed35c71cc990f8c5b6d98e20c6072c136.zip |
removing more calls to deprecated methods
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 685d818ab3..4ff61fff45 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -67,9 +67,10 @@ module ActiveRecord @reflection.klass.delete(records.map { |record| record.id }) else relation = Arel::Table.new(@reflection.table_name) - relation.where(relation[@reflection.primary_key_name].eq(@owner.id). + stmt = relation.where(relation[@reflection.primary_key_name].eq(@owner.id). and(relation[@reflection.klass.primary_key].in(records.map { |r| r.id })) - ).update(relation[@reflection.primary_key_name] => nil) + ).compile_update(relation[@reflection.primary_key_name] => nil) + @owner.connection.update stmt.to_sql @owner.class.update_counters(@owner.id, cached_counter_attribute_name => -records.size) if has_cached_counter? end |