Class: ActionController::AbstractResponse
- Inherits:
-
Object
- Object
- ActionController::AbstractResponse
- Defined in:
- lib/action_controller/response.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_HEADERS =
{ "Cache-Control" => "no-cache" }
Instance Attribute Summary collapse
-
#assigns ⇒ Object
Returns the value of attribute assigns.
-
#body ⇒ Object
Returns the value of attribute body.
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#redirected_to ⇒ Object
Returns the value of attribute redirected_to.
-
#redirected_to_method_params ⇒ Object
Returns the value of attribute redirected_to_method_params.
-
#session ⇒ Object
Returns the value of attribute session.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize ⇒ AbstractResponse
constructor
A new instance of AbstractResponse.
- #redirect(to_url, permanently = false) ⇒ Object
Constructor Details
#initialize ⇒ AbstractResponse
Returns a new instance of AbstractResponse.
6 7 8 |
# File 'lib/action_controller/response.rb', line 6 def initialize @body, @headers, @session, @assigns = "", DEFAULT_HEADERS.merge("cookie" => []), [], [] end |
Instance Attribute Details
#assigns ⇒ Object
Returns the value of attribute assigns.
4 5 6 |
# File 'lib/action_controller/response.rb', line 4 def assigns @assigns end |
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/action_controller/response.rb', line 4 def body @body end |
#cookies ⇒ Object
Returns the value of attribute cookies.
4 5 6 |
# File 'lib/action_controller/response.rb', line 4 def @cookies end |
#headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/action_controller/response.rb', line 4 def headers @headers end |
#redirected_to ⇒ Object
Returns the value of attribute redirected_to.
4 5 6 |
# File 'lib/action_controller/response.rb', line 4 def redirected_to @redirected_to end |
#redirected_to_method_params ⇒ Object
Returns the value of attribute redirected_to_method_params.
4 5 6 |
# File 'lib/action_controller/response.rb', line 4 def redirected_to_method_params @redirected_to_method_params end |
#session ⇒ Object
Returns the value of attribute session.
4 5 6 |
# File 'lib/action_controller/response.rb', line 4 def session @session end |
#template ⇒ Object
Returns the value of attribute template.
4 5 6 |
# File 'lib/action_controller/response.rb', line 4 def template @template end |
Instance Method Details
#redirect(to_url, permanently = false) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/action_controller/response.rb', line 10 def redirect(to_url, permanently = false) @headers["Status"] = "302 Found" unless @headers["Status"] == "301 Moved Permanently" @headers["location"] = to_url @body = "<html><body>You are being <a href=\"#{to_url}\">redirected</a>.</body></html>" end |