Extensions: Actioncontroller::base < Metal
2 Basic Themes:
- Get and Show
- Do and redirect
Requests
For each request, the Controller and action keys are determined by router. The remaining request parameters, the session, and all HTTP headers are made to the action via the request accessor method, and then the action is executed.
A full Request object can be used by the request accessor method. Used primarily for querying HTTP headers. For example:
def server_ip location = request.env["REMOTE_ADDR"] render plain: "This server hosted at #{location}"end
Parameters
All request parameters, whether from the query string in the URL or the data submitted by the table through a POST request, can return a hash using the params method.
Example: An action is executed through the /post?category=all&limit=5. The params will include {"category" + "All", "Limit" = 5}
Example: Similar tables
<input type="text" name="post[name]" value="david"><input type="text" name="post[address]" value="hyacintvej">
After submission, the params will include {"POST" + + {"name" + "David", "Address" = "Hyacintvej"}}
Session
Response
Renders
Redirects
About requests and responses: class Actioncontroller::base < Metal