views:

16

answers:

1

As luck would have it, I am creating a Rails application (2.3.8) in which I need to change where a request is dispatched based on some criteria. Basically, I need a custom dispatcher.

I have looked at using Rack to modify the request, and in certain instances, re-route the request to a different controller that knows that to do with the request.

I'm not looking to redirect - I need to have some requests handled by a different controller than the one the routing table gives me.

Is this even possible?

A: 

I think Rack is the answer to this. You should be able to intercept the request and alter the incoming parameters before the request hits your Rails stack.

Why not change the route to use the correct controller in the first place?

Toby Hede