Actions with hyphens?

Is there a way to configure routes.rb so that /foo/bar-baz substitues
hyphens with underscores in the action?

– fxn

On 12/1/06, Xavier N. [email protected] wrote:

Is there a way to configure routes.rb so that /foo/bar-baz substitues
hyphens with underscores in the action?

I would map it so the bar-baz arrives in params[:id], like this perhaps:

map.connect “foo/:id”,
:controller => ‘foo’,
:action => ‘bar’,
:requirements => { :id => /[\w-]+/ },
:id => nil

def bar
id = params[:id].gsub( /-/, ‘_’ )

and so on

end


Greg D.
http://destiney.com/