You can visualize the presentation in a line, catch any timeouts that may occur during rendering, register the results of the action and return the line:
begin @elements = Element.find(:all) html = render_to_string
Some other things you can do to achieve your goal may be:
You can use the rake task instead of the controller action if the code you need to execute is run only by your cron task.
Instead of directly asking for the use of wget in your cron job, you can call a script that will make a request to your controller, check the output of the request, and then register the result (possibly calling a new action in the controller).
source share