Note that the URI generators will accept either an ID or an arbitrary object. Such
objects will be converted to a URI-friendly ID using #to_param, so anything that
responds to #to_param (such as an ActiveRecord::Base or ActiveResource::Base
object) will work.
HTTP Rails Semantics
GET /people index Shows a list of all people
GET /people/new new Shows a form to create a new person
POST /people create Creates a new person; redirects to its URI
GET /people/1 show Shows a representation of the specified person
GET /people/1/edit edit Shows an edit form for the specified person
PUT /people/1 update Updates the specified person with the provided data
DELETE /people/1 destroy Removes the specified person
Named route URI Params
people_path /people {}
person_path(1)
person_path(@person)
/people/1 {:id => 1}
212 | Chapter 7: REST, Resources, and Web Services
You may occasionally see URIs like /people/1;edit when reading
information about RESTful development in Rails. For a time, the semicolon
was a route component separator (Rails 1.2 still uses it), but it
has since been removed in Rails 2.0.
These routes are also available in a _url variant that includes the scheme, host, and
port. For example, people_path returns /people, while people_url returns http://
localhost:3000/people (of course, with the appropriate scheme, host, and port,
depending on that of the incoming request).
Pages:
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333