Class: OntwerperPage::MigrationGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



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

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

.source_rootObject



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

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

Instance Method Details

#create_migrationObject



23
24
25
# File 'lib/generators/ontwerper_page/migration/migration_generator.rb', line 23

def create_migration
  migration_template "migration.rb", File.join('db/migrate', "create_ontwerper_pages.rb")
end

#create_modelsObject



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

def create_models
  template "ontwerper_page.rb",
  File.join('app/models', lego_dir, "ontwerper_page.rb")
end