Prev | Current Page 329 | Next

Brad Ediger

"Advanced Rails"

If the link is
clicked, the browser will send GET /people/1, which will harmlessly call the show
action on that person.
Note that we would not want to fall back to an action that actually calls our delete
method, because it is behind a standard HTML link (once the JavaScript is stripped
out). As the GET action is presumed to be idempotent and safe, proxy caches and user
agents would be permitted to prefetch our link without the user??™s request. This is the
same problem that caused the Google Web Accelerator issues discussed earlier. But
the advantage of RESTful design is that we could not name the delete action by URI
alone if we wanted to; it requires the resource??™s URI in conjunction with the DELETE
HTTP method, and all of the semantics involved therein.
In applications where non-JavaScript-aware browsers need to be fully
supported, you should use other helpers such as button_to or the standard
form helpers. These create HTML constructs with the proper
semantics; even user agents that do not support JavaScript respect that