Forum: Ruby on Rails required segments in routing

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5700c8561aaae47ba4aaa8f0f77e3158?d=identicon&s=25 $am (Guest)
on 2008-11-21 11:51
(Received via mailing list)

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 topic is locked and can not be replied to.