diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-01 12:07:05 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-02 10:27:39 +0200 |
commit | 555a956a66628f0c14440e350fefe62125067058 (patch) | |
tree | ab3aa5b1b0b6bb0f6ab3564f16256885d6f402a1 /railties/lib/generators | |
parent | 10a9205c583a95ef35704aca93079b1700dd35f8 (diff) | |
download | rails-555a956a66628f0c14440e350fefe62125067058.tar.gz rails-555a956a66628f0c14440e350fefe62125067058.tar.bz2 rails-555a956a66628f0c14440e350fefe62125067058.zip |
Ensure both migration and routes are removed on revoke.
Diffstat (limited to 'railties/lib/generators')
-rw-r--r-- | railties/lib/generators/migration.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/railties/lib/generators/migration.rb b/railties/lib/generators/migration.rb index 1981ea6a59..2eb7c0a964 100644 --- a/railties/lib/generators/migration.rb +++ b/railties/lib/generators/migration.rb @@ -25,11 +25,13 @@ module Rails @migration_file_name = File.basename(destination).sub(/\.rb$/, '') @migration_class_name = @migration_file_name.camelize - if existing = migration_exists?(migration_dir, @migration_file_name) - raise Rails::Generators::Error, "Another migration is already named #{@migration_file_name}: #{existing}" + destination = migration_exists?(migration_dir, @migration_file_name) + + if behavior == :invoke + raise Error, "Another migration is already named #{@migration_file_name}: #{destination}" if destination + destination = File.join(migration_dir, "#{@migration_number}_#{@migration_file_name}.rb") end - destination = File.join(migration_dir, "#{@migration_number}_#{@migration_file_name}.rb") template(source, destination, log_status) end |