Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
dhh committed Oct 18, 2007
1 parent 34df379 commit d6f49e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions railties/CHANGELOG
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails_generator/commands.rb
Expand Up @@ -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
Expand Down

0 comments on commit d6f49e4

Please sign in to comment.