## routes.rb
# The idea is to add random parameters in front of the path but still use controllers from the admin namespace not "some random path prefix" namespace

map.namespace :admin, :path_prefix => 'admin/:something' do |admin|
admin.connect 'asd/:id', :controller => 'items', :action => 'edit', :id => /\d+/
end

## rake routes
/admin/:something/asd/:id {:controller=>"admin/:something/items", :action=>"edit"}

# notice the :controller => "admin/:something/items".
# accessing /admin/10/asd/2 responds with:
# NameError in Admin/:something/itemsController#edit
# "Admin:::something::ItemsController" is not a valid constant name!


# I may be wrong to expect this to work, but an easy fix seems to be:

## fix.patch

diff --git a/actionpack/lib/action_controller/routing/builder.rb b/actionpack/lib/action_controller/routing/builder.rb
index 4740113..b832384 100644
--- a/actionpack/lib/action_controller/routing/builder.rb
+++ b/actionpack/lib/action_controller/routing/builder.rb
@@ -67,10 +67,9 @@ module ActionController
options = options.dup

if options[:namespace]
- options[:controller] = "#{options[:path_prefix]}/#{options[:controller]}"
+ options[:controller] = "#{options.delete(:namespace).sub(/\/$/, '')}/#{options[:controller]}"
options.delete(:path_prefix)
options.delete(:name_prefix)
- options.delete(:namespace)
end

requirements = (options.delete(:requirements) || {}).dup