Sha256: 0b5aa296ac5b98d2c54cc7f38c58320de54829301ed694145cfbad44ef78c97b
Contents?: true
Size: 982 Bytes
Versions: 25
Compression:
Stored size: 982 Bytes
Contents
require "rails/generators" require "rails/generators/active_record" module MasterDataTool class InstallGenerator < ::Rails::Generators::Base include ::Rails::Generators::Migration source_root File.expand_path("templates", __dir__) def self.next_migration_number(dirname) ::ActiveRecord::Generators::Base.next_migration_number(dirname) end def create_migration_file migration_dir = File.expand_path("db/migrate") template = 'create_master_data_statuses' if self.class.migration_exists?(migration_dir, template) ::Kernel.warn "Migration already exists: #{template}" else migration_template( "#{template}.rb.erb", "db/migrate/#{template}.rb", migration_version: migration_version ) end end private def migration_version format( "[%d.%d]", ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR ) end end end
Version data entries
25 entries across 25 versions & 1 rubygems