The handler returns false so that the link??™s
actual target is not followed. For example, the ERb code:
<%= link_to 'Delete', person_path(@person), :method => :delete %>
creates the following link:
DeleteHTTP Rails Semantics
GET /users/1/account/new new Shows a form to create user??™s account
POST /users/1/account create Creates the user??™s account; redirects to its URI
GET /users/1/account show Shows account information
GET /users/1/account/edit edit Shows an edit form for the account
PUT /users/1/account update Updates the account with the provided data
DELETE /users/1/account destroy Removes the account
Named route URI Params
account_path(1) /users/1/account {:user_id => 1}
new_account_path(1) /users/1/account/new {:user_id => 1}
edit_account_path(1) /users/1/account/edit {:user_id => 1}
RESTful Rails | 217
Although this uses JavaScript to accomplish its primary action, it is still safe (though
nonfunctional) in browsers that do not support JavaScript. Those browsers will
ignore the onclick action, instead treating the link as a standard GET link.
Pages:
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340