Sha256: f11bcd9ea9b8cc35f030357c5940778105be4c46b3287109195da7b3a25ee6b2

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

require 'rails/generators/active_record'

module Merit
  module Generators::ActiveRecord
    class MeritGenerator < ::ActiveRecord::Generators::Base
      include Rails::Generators::Migration

      source_root File.expand_path('../templates', __FILE__)
      desc 'add active_record merit migrations'

      def self.next_migration_number(path)
        ActiveRecord::Generators::Base.next_migration_number(path)
      end

      def copy_migrations_and_model
        migration_template 'add_merit_fields_to_model.rb',
                           "db/migrate/add_merit_fields_to_#{table_name}.rb"
      end

      def migration_version
        "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
merit-4.0.0 lib/merit/generators/active_record/merit_generator.rb