Class: Signoff::Generators::ModelGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/signoff/model/model_generator.rb

Overview

Adds the workflow state column to a model’s table.

rails generate signoff:model ExpenseReport
rails generate signoff:model Invoice --column=workflow_state --initial=pending

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



24
25
26
27
28
29
# File 'lib/generators/signoff/model/model_generator.rb', line 24

def create_migration_file
  migration_template(
    "migration.rb.tt",
    File.join(db_migrate_path, "add_#{column_name}_to_#{table_name}.rb")
  )
end