views:

55

answers:

2

Hi!

Is it good when url to show and destroy are same? How it can be changed in RoR if i want continue use standard tools like script/generate scaffold ?

Thanks.

+4  A: 

If you are following the REST convention Rails recommends, the url of a resource (noun) would be /resource_name/id for view, delete, update, and the difference will be the HTTP method (verb) you issue to the server: GET, POST, PUT, and DELETE.

duncan
Are edit and update different?
Stas
In Rails terminology, "edit" is "show the form to edit this resource," whereas "update" is "submit changes to this resource." "edit" generally only makes sense in the context of HTML. This same distinction is true for "new" versus "create."
James A. Rosen
+2  A: 

Yes, this is good. Rails use the URL as well as the HTTP verb (GET, POST, PUT, DELETE) to determine which action a request should resolve to. script/generate scaffold has this behaviour, so you can continue to use it.

August Lilleaas
Hm.. Are RoR use DELETE instead of POST in real life?
Stas
No, RoR uses POST in real life with a trick: It will automagically add a parameter to the post: _method=delete This is not so well documented, IMHO. Here's a lecture note about it:http://www.oucs.ox.ac.uk/rails/howtos/rest/handout.pdf
Larry K
@Larry K, thanks.
Stas