<commit_before>require 'model_base/generators/model_support'

module ModelBase
  module Generators
    class ControllerGenerator < ::Rails::Generators::NamedBase # :nodoc:
      include ::ModelBase::Generators::ModelSupport

      source_root File.expand_path('../templates', __FILE__)

      check_class_collision suffix: "Controller"

      class_option :helper, type: :boolean
      class_option :orm, banner: "NAME", type: :string, required: true,
                         desc: "ORM to generate the controller for"
      class_option :api, type: :boolean,
                         desc: "Generates API controller"

      def create_controller_files
        template_file = options.api? ? "api_controller.rb.erb" : "controller.rb.erb"
        template template_file, File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
      end

      # Invoke the helper using the controller name (pluralized)
      hook_for :helper, as: :scaffold do |invoked|
        invoke invoked, [ controller_name ]
      end
    end
  end
end<commit_msg>Fix options of hook_for :helper<commit_after>require 'model_base/generators/model_support'

module ModelBase
  module Generators
    class ControllerGenerator < ::Rails::Generators::NamedBase # :nodoc:
      include ::ModelBase::Generators::ModelSupport

      source_root File.expand_path('../templates', __FILE__)

      check_class_collision suffix: "Controller"

      class_option :helper, type: :boolean
      class_option :orm, banner: "NAME", type: :string, required: true,
                         desc: "ORM to generate the controller for"
      class_option :api, type: :boolean,
                         desc: "Generates API controller"

      def create_controller_files
        template_file = options.api? ? "api_controller.rb.erb" : "controller.rb.erb"
        template template_file, File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
      end

      # Invoke the helper using the controller name (pluralized)
      hook_for :helper, as: :scaffold, in: 'rails' do |invoked|
        invoke invoked, [ controller_name ]
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09499770536943553, 'fraction_numerical': 0.0, 'mean_word_length': 3.18426103646833, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6959038', 'n_tokens_mistral': 617, 'n_tokens_neox': 599, 'n_words': 161}