On 9/2/2010 3:04 AM, Ralph S. wrote:
Ok, I think I understand why RoR will flag an attempt double render in
What I don’t understand is the philosophy of render and redirect_to.
Specifically, why isn’t a return implicit in both those methods?
Or, I guess, more to the point … what are the advantages of writing
code in the action after a render/redirect_to?
I’m not sure how Rails works, but in a C++ HTTP server that we did, we
could do something like write the response to the browser and then do
the remaining house-keeping tasks. For example, it would be perfectly
fine to update the logs, perform some other calculation, etc. that does
not affect the output (since it’s been sent off already) but is
something that the system could use.
In another system, we did something like receive a request by HTTP POST,
check the parameters and acknowledge the receipt of the request to the
client as the response. Thereafter, we needed to process the request
(which took quite a while) and then we would POST the results to a URL
on the client’s side.
I think both these cases would be things that don’t need to be put into
an after_filter and would benefit from writing code in the action after
a render (assuming Rails works/ allows one to work this way).
9/2/2010 | 3:26 AM.