views:

52

answers:

2
map.resources :document

After adding this route, I now have an automatic "edit_document_path". I wanted to change this to "annotate_document_path"? Will it automatically pick this up if I add a new view and controller method? How does it translate from the resource route to these "path" notations?

+1  A: 

map.resources adds RESTful routes. You're looking for a named route. More info at RailsGuides.

Jarrod
+2  A: 

Jarrod is correct. map.resources by default only adds the RESTful routes. To get the route you want, the line should read

map.resources :document, :member => {:annotate => :get}

:member means this route will have an associated document_id, :annotate will be part of the url, and :get is the HTTP method used to access this routes.

With this line, you should have access to the annotate_document_path(document_id) helper method.

erik
Thanks !
Michael Jay