Permalink
Browse files

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
  • Loading branch information...
1 parent 34df379 commit d6f49e4af114a28e48e5c36932d35eeef614d7a0 @dhh dhh committed Oct 18, 2007
Showing with 3 additions and 1 deletion.
  1. +2 −0 railties/CHANGELOG
  2. +1 −1 railties/lib/rails_generator/commands.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Fixed incorrect migration number if script/generate executed outside of Rails root #7080 [jeremymcanally]
+
* Update Prototype to 1.6.0_rc1 and script.aculo.us to 1.8.0 preview 0. [sam, madrobby]
* Generated fixtures use the actual primary key instead of id. #4343 [Frederick Ros, Tarmo Tänav]
@@ -70,7 +70,7 @@ def migration_exists?(file_name)
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

0 comments on commit d6f49e4

Please sign in to comment.