aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/migration.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index 7a1504430b..9ac18f9939 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -509,20 +509,19 @@ module ActiveRecord
seen = Hash.new false
- migrations = files.inject([]) do |klasses, file|
+ migrations = files.map do |file|
version, name, scope = file.scan(/([0-9]+)_([_a-z0-9]*)\.?([_a-z0-9]*)?.rb/).first
- name = name.camelize
raise IllegalMigrationNameError.new(file) unless version
version = version.to_i
+ name = name.camelize
raise DuplicateMigrationVersionError.new(version) if seen[version]
raise DuplicateMigrationNameError.new(name) if seen[[name, scope]]
seen[version] = seen[[name, scope]] = true
- migration = MigrationProxy.new(name, version, file, scope)
- klasses << migration
+ MigrationProxy.new(name, version, file, scope)
end
migrations.sort_by(&:version)