Rewrite hyphen to underscore

I have a Routes question. Say I have the following routes.rb
configuration:

ActionController::Routing::Routes.draw do |map|
map.connect ‘:controller/:action’, :action =>
‘index’, :requirements => { :action => /(?:a-z*)/ }
map.connect ‘:controller/:id’, :action =>
‘show’, :requirements => { :id => /\d+/ }
map.connect ‘:controller/:id/:action’
end

Notice that I want to use hyphens in the action name? Is there
any way to “rewrite” this inside Rails so that the hyphen becomes
an underscore?

So for example I want:

/person/list-all

to map to:

:controller => ‘person’, :action => ‘list_all’

I prefer to use a hyphens in my URIs because in an underlined link
the underscore character can sometimes be mistaken for a space.

Also, for the third connect call, do I have to specify the requirements
for the :action and :id that were specified earlier if I want the same
requirements to continue to apply?

Thanks,

Dan

Hello Dan !

2005/11/15, Dan K. [email protected]:

Notice that I want to use hyphens in the action name? Is there
any way to “rewrite” this inside Rails so that the hyphen becomes
an underscore?

I blogged about that about a month ago:
http://blog.teksol.info/articles/2005/10/25/actions-with-dashes

Hope that helps !