Sha256: 5554870644a56a62c4ac4cfee15ce8ab85ff2da6de257453fde67f37bac27052

Contents?: true

Size: 798 Bytes

Versions: 3

Compression:

Stored size: 798 Bytes

Contents

require 'rails/generators'
require 'rails/generators/active_record'
require 'rails/generators/active_record/migration/migration_generator'

module SecondBase
  class MigrationGenerator < ActiveRecord::Generators::MigrationGenerator

    source_root ActiveRecord::Generators::MigrationGenerator.source_root

    def self.desc
      require 'rails/generators/rails/migration/migration_generator'
      Rails::Generators::MigrationGenerator.desc
    end

    include(Module.new{

      def migration_template(*args)
        path = Pathname
               .new(Rails.application.config.paths['db/migrate'].first)
               .relative_path_from(Rails.root)
               .to_s
        args[1].sub! path, "#{Railtie.config_path}/migrate" if args[1]
        super(*args)
      end

    })

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
secondbase-2.2.0 lib/rails/second_base/generators/migration_generator.rb
secondbase-2.1.6 lib/rails/second_base/generators/migration_generator.rb
secondbase-2.1.5 lib/rails/second_base/generators/migration_generator.rb