Routing every request to same action

Hi,

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 controller/action. I tried this in my routes.rb   map.connect 'parts/:number',:controller=>'companies' , :action=>'index' But its not working. Please help me to overcome this problem, Thanks in advance, Regards, Umair

I'm not sure I understand exactly what you want to do but if you really want _every_ request to get routed to the same action, you can use a before_filter.

In application.rb:

def route_all_to_somewhere   redirect_to :controller => 'desired_controller', :action => 'desired_action' end

and either at the beginning of application.rb or in each of your controller files:

before_filter :route_all_to_somewhere

HTH, Bill

Thank you soooo mcuh!!!thats what i was looking for! thanks again