The request
object provides details about the incoming request. Use it to query information about the request, such as params and headers.
The object inherits from Rack::Request, which provides a range of methods like #path_info
, #content_type
and #get_header
.
Response
The response
object represents your action’s outgoing HTTP response.
Use it to control how your action responds to a request by setting an outgoing status, body or headers.
By default, the response status is 200
. Setting the response status via response.status
is useful when setting statuses like 200 OK
, 201 Created
and .
In situations where you want an action to halt, for example to return a 401 Unauthorized
response, use the action’s halt
method. To return a redirect, use response.redirect_to("/path")
. See for details.