Hi there,
My routes.rb is something like
map.connect ‘:controller/:action/:id’
However, when a url request likes
http://xxx/user/category/a/b
My intension is to call
:controller => ‘user’
:action => ‘category’
:id => ‘a/b’
However, :id has slash in it (a/b) will make rails fail to route.
(apache fail, webrick works fine somehow)
It seems like rails will try to match route rule with
map.connect :controller/:action/:id/:others
but failed.
I know one solution is to call CGI.escape in link_to or url_for , like
link_to :controller => ‘user’, :action => ‘category’, :id => CGI.escape
(category)
and unescape when I got it.
category = CGI.unescape(params[:category])
Any better solution ?
Thanks.
Gary