Why not just use the already declared index method?
If you really have to have an additional list method, just add
:collection => {:list => :get} # Presuming you’re gonna use GET to “get” the page/resource
to your mapping for that resource.
But I’d seriously question the need for both an index and a list method. That’s where people are going to land normally based on the common assumptions that most routing uses. http://domain.com/controller == http://domain.com/controller/index. So you’re either going to risk reduplication [index == list] or redirection. Either way sounds like unnecessary work. Yuck.
I can see cases where you might want to use this methodology of a separate list method but not for regular cases. And certainly not just because the old scaffolding used that method. Ick. Scaffolding.
So if i had a action called 'list' then what is the best way to let
routes.rb know to except requests of http://localhost:3004/articles/list
Using REST, you can write the url:
http://localhost:3004articles and that will invoke the index method,
which would be your list method.
To create a link from a view, you would use:
articles_path
And in your routes.rb file you'd declare each RESTful controller:
map.resources :articles as you are already, and add a new declaration
for each controller.
I found the tutorial as Peep Code very useful.
If you still want to use the /articles/list url, you would set the
route something like:
map.connect ':controller/:action/'
using :collection => { :search => :get } in your map.resource
declaration in the routes.rb file is the correct way to add custom
actions to your routes.