Class: ActsAsTracked::MigrationGenerator

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

Constant Summary collapse

MIGRATION_TIMESTAMP_FORMAT =
'%Y%m%d%H%M%S'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(_path) ⇒ Object



14
15
16
# File 'lib/generators/acts_as_tracked/migration/migration_generator.rb', line 14

def self.next_migration_number(_path)
  Time.now.utc.strftime(MIGRATION_TIMESTAMP_FORMAT)
end

.source_rootObject



10
11
12
# File 'lib/generators/acts_as_tracked/migration/migration_generator.rb', line 10

def self.source_root
  File.join(File.dirname(__FILE__), 'templates', 'active_record')
end

Instance Method Details

#create_migration_fileObject



18
19
20
21
22
# File 'lib/generators/acts_as_tracked/migration/migration_generator.rb', line 18

def create_migration_file
  migration_template  'migration.erb',
                      'db/migrate/acts_as_tracked_migration.rb'
  { migration_version: migration_version }
end