diff options
author | Sam Stephenson <sam@37signals.com> | 2005-09-27 10:47:47 +0000 |
---|---|---|
committer | Sam Stephenson <sam@37signals.com> | 2005-09-27 10:47:47 +0000 |
commit | 72c3ffc7fb636859343b69fcf3c2bb418abe6883 (patch) | |
tree | 76fbb7d3e80eaa042a42660c6b628bd6ccc85e59 /railties | |
parent | 76a7a525576fa1ed12a362fac5da6e2f8b6dc92c (diff) | |
download | rails-72c3ffc7fb636859343b69fcf3c2bb418abe6883.tar.gz rails-72c3ffc7fb636859343b69fcf3c2bb418abe6883.tar.bz2 rails-72c3ffc7fb636859343b69fcf3c2bb418abe6883.zip |
Make the migration generator only check files ending in *.rb when calculating the next file name #2317 [Chad Fowler]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2362 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/migration/migration_generator.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 935a47fa0b..2785d8f1be 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Make the migration generator only check files ending in *.rb when calculating the next file name #2317 [Chad Fowler] + * Added prevention of duplicate migrations from the generator #2240 [fbeausoleil@ftml.net] * Add db_schema_dump and db_schema_import rake tasks to work with the new ActiveRecord::SchemaDumper (for dumping a schema to and reading a schema from a ruby file). diff --git a/railties/lib/rails_generator/generators/components/migration/migration_generator.rb b/railties/lib/rails_generator/generators/components/migration/migration_generator.rb index c830d715bb..3dff3bf396 100644 --- a/railties/lib/rails_generator/generators/components/migration/migration_generator.rb +++ b/railties/lib/rails_generator/generators/components/migration/migration_generator.rb @@ -4,7 +4,7 @@ class MigrationGenerator < Rails::Generator::NamedBase m.directory File.join('db/migrate') existing_migrations = Dir.glob("db/migrate/[0-9]*_#{file_name}.rb") raise "Another migration already exists with the same name" unless existing_migrations.empty? - next_migration_number = Dir.glob("db/migrate/[0-9]*.*").size + 1 + next_migration_number = Dir.glob("db/migrate/[0-9]*.rb").size + 1 m.template 'migration.rb', File.join('db/migrate', "#{next_migration_number}_#{file_name}.rb") end end |