I am reading David's book "Rails Routing" and it is really helpful. I
do have a few questions and there doesn't seem to be an errata page.
Not that I am finding a lot of errors, it is a GREAT book, just a few
little things.
specifically on page 65 it states:
The Routes for show, new, edit and destroy are singular....
I think this is a typo as I can't see how new, which is a pre-action
to create, is singular.
Granted the book was written for Rails 1.2.3, but REST has not
changed, only Rails
PS
I also read David's Ruby for Rails, which, even though it is 2 years
old, is still the best Rails book out there.
I think he means you will use `new_thing_path` rather than
`new_things_path`. Just as you would use `show_thing_path` or
`edit_thing_path` rather than a plural version. `things_path` or any
collection methods are the only routes that will be plural.
--Jeremy
Thanks Jeremy,
I guess I should have finished the sentence
It says:
The routes for show, new, edit and destroy are singular because
they're showing and editing a particular thing.
The rest of the routes are plural, They deal with the resource as a
collection.
The singular RESTful routes require an argument because they to know
the id of the particular member of the collection on which you're
operating....
My question evolves around the new_thing_url route requiring an "id"
argument
show, update, destroy and edit require an id parameter. new, index and
create do not.
The list in my mind, of singular routes (as defined above) is
different from the one in the book in that mine contains 'update' and
the book's list contains 'new' instead.
As far as the names having plurals, I haven't read that far. Maybe 2.0
changed things as I am reading a 1.2.3 book but the show, update and
destroy actions are described as being available via
things_url(@thing) with method options of 'put' and 'destroy', with
'get' as a default. I have yet to discover the show_thing_path. it's
still things_url(@thing) for me, but I'm not done reading.
I will get there, Rails intricacies take time for me to understand.
I read most of the teaser chapter, "Ruby under microscope" of your
"Ruby in Practice" book. Looks very good, I guess I am going to have
to put it in my queue behind the 1200-1500 pages of unread books that
I already own and haven't yet gotten to.
Thanks again.