Sha256: 4f20e02987685f259ce8fde9090fd6971a81cc4a75d51e0141d1033f3c3221c0
Contents?: true
Size: 819 Bytes
Versions: 2
Compression:
Stored size: 819 Bytes
Contents
# frozen_string_literal: true require "rails/generators/active_record" module SetAsPrimary module Generators class SetAsPrimaryGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path("templates", __dir__) argument :table_name, type: :string desc "Adds a boolean column 'primary' to the given table." def copy_migration migration_template "migration.rb", "db/migrate/add_primary_column_to_#{table_name}.rb", migration_version: migration_version end def migration_version "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" end def self.next_migration_number(dirname) ActiveRecord::Generators::Base.next_migration_number(dirname) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
set_as_primary-0.1.1 | lib/generators/set_as_primary/set_as_primary_generator.rb |
set_as_primary-0.1.0 | lib/generators/set_as_primary/set_as_primary_generator.rb |