Class: Rubyblok::Generators::MigrationGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Rubyblok::Generators::MigrationGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/rubyblok/migration_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
26 27 28 |
# File 'lib/generators/rubyblok/migration_generator.rb', line 26 def self.next_migration_number(dirname) ActiveRecord::Generators::Base.next_migration_number(dirname) end |
Instance Method Details
#install ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/generators/rubyblok/migration_generator.rb', line 13 def install if table_exist? migration_template('migration_update.rb.erb', "db/migrate/update_rubyblok_#{plural_file_name}.rb", migration_version:) else migration_template('migration_create.rb.erb', "db/migrate/create_rubyblok_#{plural_file_name}.rb", migration_version:) end create_or_update_model add_model_name_to_config end |