Module: ActionView::Helpers::ControllerHelper

Included in:
ActionView::Helpers
Defined in:
lib/action_view/helpers/controller_helper.rb

Overview

This module keeps all methods and behavior in ActionView that simply delegates to the controller.

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#assign_controller(controller) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/action_view/helpers/controller_helper.rb', line 18

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

#loggerObject



26
27
28
# File 'lib/action_view/helpers/controller_helper.rb', line 26

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

#respond_to?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/action_view/helpers/controller_helper.rb', line 30

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