drapergem/draper

View on GitHub
lib/generators/controller_override.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
require "rails/generators"
require "rails/generators/rails/controller/controller_generator"
require "rails/generators/rails/scaffold_controller/scaffold_controller_generator"

module Rails
  module Generators
    class ControllerGenerator
      hook_for :decorator, type: :boolean, default: true do |generator|
        invoke generator, [name.singularize]
      end
    end

    class ScaffoldControllerGenerator
      hook_for :decorator, type: :boolean, default: true
    end
  end
end