Class: ModelTimeline::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/model_timeline/generators/install_generator.rb

Overview

Rails generator that creates the necessary migration file for ModelTimeline. his generator creates a migration to set up the timeline entries table.

Examples:

$ rails generate model_timeline:install

With custom table name

$ rails generate model_timeline:install --table_name=custom_timeline_entries

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ String

Returns the next migration number to be used in the migration filename



31
32
33
# File 'lib/model_timeline/generators/install_generator.rb', line 31

def self.next_migration_number(dirname)
  ActiveRecord::Generators::Base.next_migration_number(dirname)
end

Instance Method Details

#create_migration_filevoid

This method returns an undefined value.

Creates the migration file for ModelTimeline tables



38
39
40
41
# File 'lib/model_timeline/generators/install_generator.rb', line 38

def create_migration_file
  @table_name = options[:table_name] || 'model_timeline_timeline_entries'
  migration_template 'migration.rb.tt', 'db/migrate/create_model_timeline_tables.rb'
end