On 12/1/06, Xavier Noria <fxn-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org>
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 Donald
http://destiney.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---