Topic: Github like routes in Rails

Using github like chain routes in rails Here is my scenario I have URL Similar like this 'localhost:3000/document_managers/[:module_name]' 'localhost:3000/document_managers/[:module_name]/1/2/3/.'[can be any level deep]

here is the routes defined for the same

map.connect '/document_managers/:module ,:controller => "document_managers",:action => :new_tree,:module => ["A","B","C"]

map.connect '/docuemnt_managers/:module/*path :controller => "document_managers" ,:action => "new_tree" :module => ["A","B,"C"]

Here are the problem I'm facing

The idea that module name can't value be anything except from the given above array i.e("A","B","C") like at any time the URL must be something like
localhost:3000/document_managers/A/1 or localhost:3000/document_managers/B/221/1 or localhost:3000/document_managers/C/121/1

but that not the case even though I localhost:3000/document_managers/D/121/1 is treated as valid url and module is set to D even though the "D" is not in listed array above

I want the the URL localhost:3000/document_managers/A to also redirect to same action i.e new_tree if the extra parameter isn't provided as in the URL contain extra parameters
localhost:3000/document_managers/C/121/1 then the URL is redirected appropritely to the desired controller and action but if the URL only contain the path till the module name the Rails return a "routes ActionController::UnknownAction" I don't know why as I have already defined the controller and action

Last edited by Viren Negi (2011-09-21 13:47:09)