Browse files

remove calls to deprecated methods

  • Loading branch information...
1 parent b0fc912 commit 9a3e29e126d9daf6175b4d2be50112d1c8771d17 @tenderlove tenderlove committed Dec 2, 2010
View
5 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -76,9 +76,10 @@ def delete_records(records)
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
View
3 activerecord/lib/active_record/migration.rb
@@ -696,7 +696,8 @@ def record_version_state_after_migrating(version)
@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

0 comments on commit 9a3e29e

Please sign in to comment.