Permalink
Browse files

use the model to delete records

  • Loading branch information...
1 parent ad2af42 commit 85e5fac959cc8345abf8690d1ba4ea11f6bc5732 @tenderlove tenderlove committed Jan 13, 2012
Showing with 1 addition and 4 deletions.
  1. +1 −4 activerecord/lib/active_record/migration.rb
@@ -752,13 +752,10 @@ def validate(migrations)
end
def record_version_state_after_migrating(version)
- table = Arel::Table.new(self.class.schema_migrations_table_name)
-
@migrated_versions ||= []
if down?
@migrated_versions.delete(version)
- stmt = table.where(table["version"].eq(version.to_s)).compile_delete
- Base.connection.delete stmt
+ ActiveRecord::SchemaMigration.where(:version => version.to_s).delete_all
else
@migrated_versions.push(version).sort!
ActiveRecord::SchemaMigration.create!(:version => version.to_s)

0 comments on commit 85e5fac

Please sign in to comment.