Class: Protokoll::Generators::Migration::ScopeByGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



20
21
22
# File 'lib/generators/protokoll/migration/scope_by_generator.rb', line 20

def self.next_migration_number(path)
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

.source_rootObject



16
17
18
# File 'lib/generators/protokoll/migration/scope_by_generator.rb', line 16

def self.source_root
  @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#create_migration_fileObject



11
12
13
14
# File 'lib/generators/protokoll/migration/scope_by_generator.rb', line 11

def create_migration_file
  migration_name = "add_scope_by_to_custom_auto_increments.rb"
  migration_template migration_name, File.join('db', 'migrate', migration_name)
end