Routing problem: map.testroute ":param1/:param2-:param3-:param4.html"

hi,

I’m trying to create meaningful urls with routing extracting all
params as specified:

map.testroute “:param1/:param2-for-:param3.html”

However this approach totally fails - it says Routing Error, No route
matches “/aaaa/bbbb-for-ccc.html” with {:method=>:get}

Then while browsing source code and some googling I’ve found that
there is sth called

ActionController::Routing::SEPARATORS

so I’ve modified it in environment.rb:

ActionController::Routing::SEPARATORS << ‘-’
ActionController::Routing::Routes.reload!

Things were getting better now, request was processed as expected,
however param1 does not accept - in it so:

GET /aa-aa/bbbb-for-ccc.html

still says:

No route matches “/aa-aa/bbbb-for-ccc.html” with {:method=>:get}

Right now I’m out of ideas how to fix this using routes, probably I’ll
try to create glob route and extract all params in before_filter.

Does anyone has an idea how to solve such problem ?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs