Sha256: dc9deb73c288ef056f169416324cbd5a21c124bf27ed6eeeec71067401ae5530

Contents?: true

Size: 1.22 KB

Versions: 38

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require "active_support/core_ext/module/attr_internal"

module ActionView
  module Helpers # :nodoc:
    # This module keeps all methods and behavior in ActionView
    # that simply delegates to the controller.
    module ControllerHelper # :nodoc:
      attr_internal :controller, :request

      CONTROLLER_DELEGATES = [:request_forgery_protection_token, :params,
        :session, :cookies, :response, :headers, :flash, :action_name,
        :controller_name, :controller_path]

      delegate(*CONTROLLER_DELEGATES, to: :controller)

      def assign_controller(controller)
        if @_controller = controller
          @_request = controller.request if controller.respond_to?(:request)
          @_config  = controller.config.inheritable_copy if controller.respond_to?(:config)
          @_default_form_builder = controller.default_form_builder if controller.respond_to?(:default_form_builder)
        end
      end

      def logger
        controller.logger if controller.respond_to?(:logger)
      end

      def respond_to?(method_name, include_private = false)
        return controller.respond_to?(method_name) if CONTROLLER_DELEGATES.include?(method_name.to_sym)
        super
      end
    end
  end
end

Version data entries

38 entries across 36 versions & 4 rubygems

Version Path
actionview-7.0.8.7 lib/action_view/helpers/controller_helper.rb
actionview-7.0.8.6 lib/action_view/helpers/controller_helper.rb
actionview-7.0.8.5 lib/action_view/helpers/controller_helper.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actionview-7.0.8.4/lib/action_view/helpers/controller_helper.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/actionview-7.0.5.1/lib/action_view/helpers/controller_helper.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/actionview-7.0.5.1/lib/action_view/helpers/controller_helper.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/actionview-7.0.5.1/lib/action_view/helpers/controller_helper.rb
actionview-7.0.8.4 lib/action_view/helpers/controller_helper.rb
actionview-7.0.8.1 lib/action_view/helpers/controller_helper.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actionview-7.0.3.1/lib/action_view/helpers/controller_helper.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actionview-7.0.2.3/lib/action_view/helpers/controller_helper.rb
actionview-7.0.8 lib/action_view/helpers/controller_helper.rb
actionview-7.0.7.2 lib/action_view/helpers/controller_helper.rb
actionview-7.0.7.1 lib/action_view/helpers/controller_helper.rb
actionview-7.0.7 lib/action_view/helpers/controller_helper.rb
actionview-7.0.6 lib/action_view/helpers/controller_helper.rb
actionview-7.0.5.1 lib/action_view/helpers/controller_helper.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/actionview-7.0.2.3/lib/action_view/helpers/controller_helper.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/actionview-7.0.3.1/lib/action_view/helpers/controller_helper.rb
actionview-7.0.5 lib/action_view/helpers/controller_helper.rb