开发者

Rails 3 output flushing

开发者 https://www.devze.com 2023-01-23 17:42 出处:网络
How can I \"flush\" output in Ruby on Rails 3? In PHPI would do something l开发者_C百科ike the following:

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

精彩评论

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