开发者

Rails Modify Request Route

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 in开发者_StackOverflow中文版stances, 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?


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜