# Controller Helper

**委托 Controller 方法给 View 使用。**

```ruby
delegate :params, :session, :cookies, :flash,
         :response, :headers, :action_name, :controller_name, :controller_path,
         :request_forgery_protection_token,
         :to => :controller
```

效果和使用 `helper_method` 类似。

ActionView::Base initialize 时就会引入。(其实，它就是从 Base 里抽取出来的)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kelby.gitbook.io/rails-beginner-s-guide/actionview_helper_method/actionview_helper_methods_introduction/controller_helper.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
