开发者

How to invoke/simulate request to any url of application inside of application

Ho开发者_如何学编程w can I invoke a request to any url (controller/action) of my Rails3 application inside of application?

I've tried to use app object (Application) with get method, but it works only from console and not in the application.

For example: I have a controller that could handle all requests. It is not configured in routes.rb and this controller could parse the request.uri and return HTML in accordance of request. I need to get this html inside of application in other controller.


What you are asking for is the component feature that was officially removed from Rails in 2008 because it was slow and leads to bad design practices.

You can try to reproduce the feature, if you really need it. Or you can perform a new HTTP request internally (using a HTTP client) to the second location, get the response and then return the result.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜