Class: AuthRails::MigrationGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



35
36
37
38
# File 'lib/generators/auth_rails/migration_generator.rb', line 35

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

Instance Method Details

#create_migration_filesObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/auth_rails/migration_generator.rb', line 21

def create_migration_files
  @model = (options[:model] || 'user').underscore.to_sym

  case options[:strategy]
  when 'allowed_token'
    migration_template(
      'allowed_tokens.tt',
      'db/migrate/create_allowed_tokens.rb',
      migration_version: migration_version
    )
  end
end