Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 72c3ffc7fb
Fetching contributors…

Cannot retrieve contributors at this time

12 lines (11 sloc) 0.495 kb
class MigrationGenerator < Rails::Generator::NamedBase
def manifest
record do |m|
m.directory File.join('db/migrate')
existing_migrations = Dir.glob("db/migrate/[0-9]*_#{file_name}.rb")
raise "Another migration already exists with the same name" unless existing_migrations.empty?
next_migration_number = Dir.glob("db/migrate/[0-9]*.rb").size + 1
m.template 'migration.rb', File.join('db/migrate', "#{next_migration_number}_#{file_name}.rb")
end
end
end
Jump to Line
Something went wrong with that request. Please try again.