aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails_generator
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-10-18 15:54:01 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-10-18 15:54:01 +0000
commitd6f49e4af114a28e48e5c36932d35eeef614d7a0 (patch)
tree62e54f712fd245431c61c114cf37a062297353f8 /railties/lib/rails_generator
parent34df379467af9541b2006fb2d5794b1ee4099e82 (diff)
downloadrails-d6f49e4af114a28e48e5c36932d35eeef614d7a0.tar.gz
rails-d6f49e4af114a28e48e5c36932d35eeef614d7a0.tar.bz2
rails-d6f49e4af114a28e48e5c36932d35eeef614d7a0.zip
Fixed incorrect migration number if script/generate executed outside of Rails root (closes #7080) [jeremymcanally]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7963 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails_generator')
-rw-r--r--railties/lib/rails_generator/commands.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb
index b541c6f65d..98531d9771 100644
--- a/railties/lib/rails_generator/commands.rb
+++ b/railties/lib/rails_generator/commands.rb
@@ -70,7 +70,7 @@ module Rails
end
def current_migration_number
- Dir.glob("#{@migration_directory}/[0-9]*.rb").inject(0) do |max, file_path|
+ Dir.glob("#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb").inject(0) do |max, file_path|
n = File.basename(file_path).split('_', 2).first.to_i
if n > max then n else max end
end