On 25 Nov 2008, at 10:11, Ju Lian wrote:
>
> <%= link_to 'New product', new_product_path %>
>
> what is this function edit_product_path and why the result is
> /1/edit and not /edit/1
>
Short answer: restful routing. When you declare a route for products  
in routes.rb this add a bunch of named routes, so new_product_path is  
the url which gives you the path where the new product form is,  
edit_product_path(some_product) is the url for editing some_product  
etc...

> And why both work?
>
because you still have the old controller/action/id routes in your  
routes.rb file
> ???
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to