Class: SeedMigrator::CreateGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- SeedMigrator::CreateGenerator
- Includes:
- Generators::SeedMigrator::Helper, Rails::Generators::Migration
- Defined in:
- lib/generators/seed_migrator/create/create_generator.rb
Overview
Generator to create a data update + associated migration
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
The next available migration number for the given directory name.
Instance Method Summary collapse
-
#create_helper_file ⇒ Object
Creates the data update file and the migration file.
Methods included from Generators::SeedMigrator::Helper
#application?, #application_class_name, #application_name, #data_update_class_name, #data_update_file_name, #full_application_class_name, #version_suffix
Class Method Details
.next_migration_number(dirname) ⇒ Object
The next available migration number for the given directory name.
18 19 20 |
# File 'lib/generators/seed_migrator/create/create_generator.rb', line 18 def self.next_migration_number dirname ActiveRecord::Generators::Base.next_migration_number dirname end |
Instance Method Details
#create_helper_file ⇒ Object
Creates the data update file and the migration file.
12 13 14 15 |
# File 'lib/generators/seed_migrator/create/create_generator.rb', line 12 def create_helper_file migration_template "data_update.rb", "db/data_updates/#{file_name}_data_update.rb" migration_template "data_update_migration.rb", "db/migrate/#{file_name}.rb" end |