Sha256: 53d91a56e3af5c705b932e1a36cb404d33082a3e7bf0e23d12f54f1c57ed21f7

Contents?: true

Size: 590 Bytes

Versions: 2

Compression:

Stored size: 590 Bytes

Contents

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

class CustomReportGenerator < 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_custom_report_table.rb'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
custom_report-0.0.2 lib/generators/custom_report/custom_report_generator.rb
custom_report-0.0.1 lib/generators/custom_report/custom_report_generator.rb