Class: DeviseSessionable::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

Implement the required interface for Rails::Generators::Migration.



15
16
17
18
19
20
21
22
# File 'lib/generators/devise_sessionable/install/install_generator.rb', line 15

def self.next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  if ActiveRecord::Base.timestamped_migrations
    [Time.now.utc.strftime('%Y%m%d%H%M%S'), '%.14d' % next_migration_number].max
  else
    '%.3d' % next_migration_number
  end
end

Instance Method Details

#copy_migrationObject



9
10
11
12
# File 'lib/generators/devise_sessionable/install/install_generator.rb', line 9

def copy_migration
  migration_template 'migration.rb',
                     'db/migrate/devise_sessionable_create_sessions.rb'
end