aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt
diff options
context:
space:
mode:
authorMike Gunderloy <MikeG1@larkfarm.com>2008-11-04 20:18:47 -0600
committerMike Gunderloy <MikeG1@larkfarm.com>2008-11-04 20:18:47 -0600
commit37ea9de5af3fc8c133bbff060c11750bcb6970de (patch)
treed3ba7c2d688571fd32cd5640067ea78ba3dbc090 /railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt
parent746fed22ff5aebe372f55c083bbf0682d02e0381 (diff)
downloadrails-37ea9de5af3fc8c133bbff060c11750bcb6970de.tar.gz
rails-37ea9de5af3fc8c133bbff060c11750bcb6970de.tar.bz2
rails-37ea9de5af3fc8c133bbff060c11750bcb6970de.zip
Copy edit on AC Basics Guide
Diffstat (limited to 'railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt')
-rw-r--r--railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt18
1 files changed, 9 insertions, 9 deletions
diff --git a/railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt b/railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt
index 06844f0a1e..250f84bd72 100644
--- a/railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt
+++ b/railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt
@@ -1,13 +1,13 @@
-== The request and response objects ==
+== The +request+ and +response+ Objects ==
-In every controller there are two accessor methods pointing to the request and the response objects associated with the request cycle that is currently in execution. The `request` method contains an instance of AbstractRequest and the `response` method returns the response object representing what is going to be sent back to the client.
+In every controller there are two accessor methods pointing to the request and the response objects associated with the request cycle that is currently in execution. The `request` method contains an instance of AbstractRequest and the `response` method returns a +response+ object representing what is going to be sent back to the client.
-=== The request ===
+=== The +request+ Object ===
-The request object contains a lot of useful information about the request coming in from the client. To get a full list of the available methods, refer to the link:http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html[API documentation].
+The request object contains a lot of useful information about the request coming in from the client. To get a full list of the available methods, refer to the link:http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html[API documentation]. Among the properties that you can access on this object:
* host - The hostname used for this request.
- * domain - The hostname without the first part (usually "www").
+ * domain - The hostname without the first segment (usually "www").
* format - The content type requested by the client.
* method - The HTTP method used for the request.
* get?, post?, put?, delete?, head? - Returns true if the HTTP method is get/post/put/delete/head.
@@ -18,11 +18,11 @@ The request object contains a lot of useful information about the request coming
* remote_ip - The IP address of the client.
* url - The entire URL used for the request.
-==== path_parameters, query_parameters and request_parameters ====
+==== +path_parameters+, +query_parameters+ and +request_parameters+ ====
-Rails collects all of the parameters sent along with the request in the `params` hash, whether they are sent as part of the query string or the post body. The request object has three accessors that give you access to these parameters depending on where they came from. The `query_parameters` hash contains parameters that were sent as part of the query string while the `request_parameters` hash contains parameters sent as part of the post body. The `path_parameters` hash contains parameters that were recognised by the routing as being part of the path leading to this particular controller and action.
+Rails collects all of the parameters sent along with the request in the `params` hash, whether they are sent as part of the query string or the post body. The request object has three accessors that give you access to these parameters depending on where they came from. The `query_parameters` hash contains parameters that were sent as part of the query string while the `request_parameters` hash contains parameters sent as part of the post body. The `path_parameters` hash contains parameters that were recognized by the routing as being part of the path leading to this particular controller and action.
-=== The response ===
+=== The +response+ Object ===
The response object is not usually used directly, but is built up during the execution of the action and rendering of the data that is being sent back to the user, but sometimes - like in an after filter - it can be useful to access the response directly. Some of these accessor methods also have setters, allowing you to change their values.
@@ -33,7 +33,7 @@ The response object is not usually used directly, but is built up during the exe
* charset - The character set being used for the response. Default is "utf8".
* headers - Headers used for the response.
-==== Setting custom headers ====
+==== Setting Custom Headers ====
If you want to set custom headers for a response then `response.headers` is the place to do it. The headers attribute is a hash which maps header names to their values, and Rails will set some of them - like "Content-Type" - automatically. If you want to add or change a header, just assign it to `headers` with the name and value: