Is there a way to configure routes.rb so that /foo/bar-baz substitues
hyphens with underscores in the action?
– fxn
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( /-/, ‘_’ )
end
–
Greg D.
http://destiney.com/
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs