Forum: Ruby on Rails Routing Problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Florian G. (Guest)
on 2007-05-13 03:08
Hi, I have the following route setup

--
map.auth 'users/auth/:action/:id',
        :controller => 'users/auth', :action => nil, :id => nil

map.authadmin 'users/authadmin/:action/:id',
      :controller => 'users/authadmin', :action => nil, :id => nil

# Allow downloading Web Service WSDL as a file with an extension
# instead of a file named 'wsdl'
map.connect ':controller/service.wsdl', :action => 'wsdl'
map.admin 'admin/:controller/:action/:id', :module => 'admin'
map.file_upload 'file_uploader/:controller/:action/:id', :module =>
'file_uploader'

map.connect ':lang/:controller/:action/:id'

# Install the default route as the lowest priority.
map.connect ':controller/:action/:id', :lang => 'de'

map.index '', :lang => 'de', :controller => 'employees'
--

and the following problem:

This works like a charm on my development system, but has an error on my
production system (textdrive). It should recognize
'my_host/admin/employees' as a route to Admin::EmployeesController and
'my_host/employees' as one to EmployeesController. The above code
usually works.

On Textdrive, this first route gets recognized as a route to
EmployeesController with params {:lang => 'admin', :controller =>
'employees'}, although map.admin is defined first. map.auth an
map.file_upload both work fine. Rails is found in vendor and is thus the
same version on both systems. Does anyone have an idea what could cause
this behaviour?

P.S.: If you wonder about :module, this is a small hack to make it
possible to force a module:

module ActionController
  module Routing
    class RouteSet
      def recognize(request)
        params = recognize_path(request.path,
extract_request_environment(request))
        request.path_parameters = params.with_indifferent_access

        controller = [params[:module],
params[:controller]].compact.join('/')

        "#{controller.camelize}Controller".constantize
      end
    end
  end
end

P.P.S.: Please, I don't want to discuss whether or not to use
controllers in modules.
This topic is locked and can not be replied to.