When you follow the convention of using resourceful routes in your config/routes.rb
, according to http://guides.rubyonrails.org/routing.html, then you benefit for having nice path and url helpers available.
To see what paths are available, just run rake routes
, and you'll see output like:
% rake routes
tickets GET /tickets(.:format) tickets#index
POST /tickets(.:format) tickets#create
new_ticket GET /tickets/new(.:format) tickets#new
edit_ticket GET /tickets/:id/edit(.:format) tickets#edit
ticket GET /tickets/:id(.:format) tickets#show
PUT /tickets/:id(.:format) tickets#update
DELETE /tickets/:id(.:format) tickets#destroy
From this, we can see that there's a named route edit_ticket
, so we can use the edit_ticket_path
or edit_ticket_url
helpers (the latter will include the domain name, and is useful for things like emails).
It's useful to compare the output of rake routes
to what you have in your config/routes.rb
to make sure you have a good understanding of rails conventions and resourceful routes.