Forum: Rails deployment Routing every request to same action

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.
72686fe21fe729b3fa756daa80dcdae2?d=identicon&s=25 Umair Ejaz (umair)
on 2009-03-30 23:07

I have some problem, I want to route every request from URL to an action
in my one controller.
   Like if I enter localhost:3000/rac .Here it will take the 'rac' as a
controller name and then route it to the 'index' action of the 'rac'
controller. But what I want is that it should redirect towards
:controller=>'companies' :action=>'index' , doesnt matter that 'rac'
controller exisits or not, It should just redirect to my desired
 I tried this in my routes.rb
  map.connect 'parts/:number',:controller=>'companies' ,
 But its not working.
Please help me to overcome this problem,
Thanks in advance,,
Da55727b189e6a3ddee2ec69f68e0ffb?d=identicon&s=25 Sj Tib (sktib)
on 2009-05-06 22:44
Try this in your routes.rb

  map.connect "*anything", :controller => "companies", :action =>

I tried only a few examples and it seems to work. Though I think you
will need to place this line before the two generic connect commands as

  map.connect "*anything", :controller => "companies", :action =>
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'

If you are going to route all your requests to companies/index then you
probably don't need the last two connect commands anyways and can get
rid of them.

This topic is locked and can not be replied to.