Class: Zencodable::Generators::Migration

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/zencodable/migration_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/generators/zencodable/migration_generator.rb', line 16

def self.next_migration_number(dirname)
  if ActiveRecord::Base.timestamped_migrations
    migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
    migration_number += 1
    migration_number.to_s
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

Instance Method Details

#create_migration_filesObject



26
27
28
# File 'lib/generators/zencodable/migration_generator.rb', line 26

def create_migration_files
  migration_template 'zencodable_add_tracking_columns_and_tables.rb', "db/migrate/zencodable_add_tracking_columns_and_tables"
end