开发者

Rails 3 output flushing

How can I "flush" output in Ruby on Rails 3?

In PHP I would do something l开发者_C百科ike the following:

$i = 0;
$total = count($result);
foreach ( $result as $item ) {
    $i++;
    time_consuming_action($item);
    echo "Finished $i of $total<br>";
    flush();
}


I do believe there is a plugin for that.

https://github.com/oggy/template_streaming


STDOUT.flush

works for regular Ruby.


template_streaming does not support Rails 3, yet...

https://github.com/oggy/template_streaming/issues/closed#issue/4

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜