When you type rake routes in the shell it displays a nice list of routes:
new_edition GET /editions/new(.:format) editions#new
edit_edition GET /editions/:id/edit(.:format) editions#edit
edition GET /editions/:id(.:format) editions#show
PUT /editions/:id(.:format) editions#update
DELETE /editions/:id(.:format) editions#destroy
This is very helpful but why not show the actual code needed to be used in the app as well for example
edition GET /editions/:id(.:format) editions#show edition_path()
I am guess it is because there may be more to it then this but the general issue is when I look at the examples give for the routes I have look up an example of how it is expressly coded to understand what the route means…
Using
xxx_pathdirectly isn’t the only option you have.Rails offers you resourceful way of building urls via
polymorpic_path/_urlmethods. These methods are used by many other helpers, like:So, by looking at
preview_invoiceprefix you know what to do, but the exact way is up to you.