Sha256: 60f1908f7befcfbbef111ef4d988c2333917ce5a65c20bb5b483d1eacbde3ff2

Contents?: true

Size: 594 Bytes

Versions: 3

Compression:

Stored size: 594 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.rb'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reservation-0.1.0 lib/generators/reservation/migration/migration_generator.rb
reservation-0.0.6 lib/generators/reservation/migration/migration_generator.rb
reservation-0.0.5 lib/generators/reservation/migration/migration_generator.rb