Class: YourGemName::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/generators/permissify/install/install_generator.rb', line 41

def self.next_migration_number(path)
  unless @prev_migration_nr
    @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
  else
    @prev_migration_nr += 1
  end
  @prev_migration_nr.to_s
end

Instance Method Details

#copy_migrationsObject



50
51
52
53
# File 'lib/generators/permissify/install/install_generator.rb', line 50

def copy_migrations
  migration_template "create_something.rb", "db/migrate/create_something.rb"
  migration_template "create_something_else.rb", "db/migrate/create_something_else.rb"
end