Required segments in routing


Has anyone an explanation why the following routing is not working?

ActionController::Routing::Routes.draw do |map|
map.namespace :admin do |admin|
admin.connect ‘:controller/:action/:id’
admin.connect ‘:controller/:action/:id.:format’
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’

The following error message ist caused only by “admin.connect
Route segment “:controller” cannot be optional because it precedes a
required segment. This segment will be required.

Replacing it with the following rule works fine:

map.connect ‘admin/users/:action.:format’, { :controller => ‘admin/
users’ }

Interestingly, the variant without explicit format works fine under
the namespace…

Any idea?


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