Rails2 to rails3 routes migration problem - namespaces

Hello,

I've got some problems migrating from rails2 to rails3: I have some
controllers in a subdirectory, and I want to access them in a
non-restful/resourceful way.

Previously I just created a controller in /util, prefixed the class name
with Util:: and it worked, that is /util/controller_name/action_name was
routed properly.

I was trying various approaches with :namespace, e.g.:

namespace :util do
    match ':controller(/:action(/:id(.:format)))'
end

but that throws an exception during boot: ":controller segment is not
allowed within a namespace block"

What is the proper way to map such controllers?

The Routing guide seems to cover this topic pretty well:

http://edgeguides.rubyonrails.org/routing.html#dynamic-segments

Ah, I was looking for a proper :namespace usage. This indeed helps,
though now I have:

  match ':controller(/:action(/:id))', :controller => /tabs\/[^\/]+/
  match ':controller(/:action(/:id))', :controller => /util\/[^\/]+/
  match ':controller(/:action(/:id(.:format)))'

which may not seem obvious at first. But you just need a way to tell
Rails to look beyond the first / when finding the controller name.

Thanks,
Adam