Class: DataMigrationGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/data_migration_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



9
10
11
12
13
14
15
# File 'lib/generators/data_migration_generator.rb', line 9

def create_migration_file
  migration_file_name =
    "#{RailsDataMigrations::Migrator.migrations_path}/#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_#{file_name}.rb"
  copy_file 'data_migration_generator.rb', migration_file_name do |content|
    content.sub(/ClassName/, file_name.camelize)
  end
end