Sha256: 3a12761bcca66ced7a2769d61d3f9e76e2e8fee0cdc33bdca62e519115dbeaaa

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

require "rails/generators"

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

  desc "Generates migration for ABTest model"

  def self.source_root
    File.join(File.dirname(__FILE__), "templates")
  end

  def self.next_migration_number(dirname) #:nodoc:
    migration_number_attempt = Time.now.utc.strftime("%Y%m%d%H%M%S")

    if ActiveRecord::Base.timestamped_migrations && migration_number_attempt > current_migration_number(dirname).to_s
      migration_number_attempt
    else
      serial_migration_number(dirname)
    end
  end

  def copy_migration
    migration_template "create_log_books.rb", "db/migrate/create_log_books.rb"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
log_book-0.0.1 lib/generators/log_book/migration_generator.rb