1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

reduce the number of calls to camelize

This commit is contained in:
Aaron Patterson 2010-10-03 16:36:43 -07:00
parent e6583901e5
commit 40761c4bf3

View file

@ -509,6 +509,7 @@ module ActiveRecord
migrations = files.inject([]) do |klasses, file| migrations = files.inject([]) do |klasses, file|
version, name, scope = file.scan(/([0-9]+)_([_a-z0-9]*)\.?([_a-z0-9]*)?.rb/).first version, name, scope = file.scan(/([0-9]+)_([_a-z0-9]*)\.?([_a-z0-9]*)?.rb/).first
name = name.camelize
raise IllegalMigrationNameError.new(file) unless version raise IllegalMigrationNameError.new(file) unless version
version = version.to_i version = version.to_i
@ -517,11 +518,11 @@ module ActiveRecord
raise DuplicateMigrationVersionError.new(version) raise DuplicateMigrationVersionError.new(version)
end end
if klasses.detect { |m| m.name == name.camelize && m.scope == scope } if klasses.detect { |m| m.name == name && m.scope == scope }
raise DuplicateMigrationNameError.new(name.camelize) raise DuplicateMigrationNameError.new(name)
end end
migration = MigrationProxy.new(name.camelize, version, file, scope) migration = MigrationProxy.new(name, version, file, scope)
klasses << migration klasses << migration
end end