Class: Segmentor::Generators::InstallGenerator

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

Overview

InstallGenerator is a generator for the Segmentor gem.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



14
15
16
17
# File 'lib/generators/segmentor/segmentor.rb', line 14

def self.next_migration_number(path)
  next_migration_number = current_migration_number(path) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Instance Method Details

#copy_migrationsObject



19
20
21
22
23
24
# File 'lib/generators/segmentor/segmentor.rb', line 19

def copy_migrations
  migration_template 'create_segmentor_tables.rb',
                     'db/migrate/create_segmentor_tables.rb'

  puts 'DB migration generated. Run rake db:migrate next'
end