diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-02 15:56:55 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-02 15:56:55 -0800 |
commit | 9a3e29e126d9daf6175b4d2be50112d1c8771d17 (patch) | |
tree | b5985576aee0779035ac7e885f04eda887ce6c1c | |
parent | b0fc912f1b829391760b50107dad365fa87c744f (diff) | |
download | rails-9a3e29e126d9daf6175b4d2be50112d1c8771d17.tar.gz rails-9a3e29e126d9daf6175b4d2be50112d1c8771d17.tar.bz2 rails-9a3e29e126d9daf6175b4d2be50112d1c8771d17.zip |
remove calls to deprecated methods
-rw-r--r-- | activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 3 |
2 files changed, 5 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 367104ec1b..e2ce9aefcf 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 @@ -76,9 +76,10 @@ module ActiveRecord records.each { |record| @owner.connection.delete(interpolate_sql(sql, record)) } else relation = Arel::Table.new(@reflection.options[:join_table]) - relation.where(relation[@reflection.primary_key_name].eq(@owner.id). + stmt = relation.where(relation[@reflection.primary_key_name].eq(@owner.id). and(relation[@reflection.association_foreign_key].in(records.map { |x| x.id }.compact)) - ).delete + ).compile_delete + @owner.connection.delete stmt.to_sql end end diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index b4b9dfab88..d80416149e 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -696,7 +696,8 @@ module ActiveRecord @migrated_versions ||= [] if down? @migrated_versions.delete(version) - table.where(table["version"].eq(version.to_s)).delete + stmt = table.where(table["version"].eq(version.to_s)).compile_delete + Base.connection.delete stmt.to_sql else @migrated_versions.push(version).sort! stmt = table.compile_insert table["version"] => version.to_s |