Sha256: 75982dd5ac4388407ba3cede31bd286ef658cc35212ba02c682e97b05cf8c75a
Contents?: true
Size: 827 Bytes
Versions: 8
Compression:
Stored size: 827 Bytes
Contents
# frozen_string_literal: true require "rails/generators" require "generators/statesman/generator_helpers" module Statesman class ActiveRecordTransitionGenerator < Rails::Generators::Base include Statesman::GeneratorHelpers desc "Create an ActiveRecord-based transition model" \ "with the required attributes" 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("create_migration.rb.erb", migration_file_name) template("active_record_transition_model.rb.erb", model_file_name) end private def migration_file_name "db/migrate/#{next_migration_number}_create_#{table_name}.rb" end end end
Version data entries
8 entries across 8 versions & 1 rubygems