Sha256: 9a0b4f1a35d6aeff2a678a02a89f31ee2f6fa0d3098ef6d1a1588d72e230af86

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'

class Reservation::MigrationGenerator < Rails::Generators::Base
  include Rails::Generators::Migration

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

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

  def create_migration_file
    migration_template 'migration.rb', 'db/migrate/create_reservations_tables.rb'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reservation-0.0.4 lib/generators/reservation/migration/migration_generator.rb