Class: Hystorical::DatesGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



7
8
9
# File 'lib/generators/hystorical/dates_generator.rb', line 7

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

Instance Method Details

#hystorical_migrationObject



11
12
13
# File 'lib/generators/hystorical/dates_generator.rb', line 11

def hystorical_migration
  migration_template 'migration.rb', File.join('db/migrate', "add_start_date_end_date_to_#{model.tableize}.rb")
end