Sha256: eab2c25245c4a7f4f10d5a04697b0b87111fb8937580104ebbaebf9a696c9218
Contents?: true
Size: 767 Bytes
Versions: 23
Compression:
Stored size: 767 Bytes
Contents
# frozen_string_literal: true require "rails/generators" require "generators/statesman/generator_helpers" # Add statesman attributes to a pre-existing transition class module Statesman class MigrationGenerator < Rails::Generators::Base include Statesman::GeneratorHelpers desc "Add the required Statesman attributes to your transition model" argument :parent, type: :string, desc: "Your parent model name" argument :klass, type: :string, desc: "Your transition model name" source_root File.expand_path("templates", __dir__) def create_model_file template("update_migration.rb.erb", file_name) end private def file_name "db/migrate/#{next_migration_number}_add_statesman_to_#{table_name}.rb" end end end
Version data entries
23 entries across 23 versions & 1 rubygems