如何在Ruby中实现进度条?

我们希望在我们的一个Ruby应用程序中实现文件上载的进度条。 这需要显示上传的确切百分比。 但是,尽管我们付出了最大努力,但我们找不到实现完全复制文件上载过程的进度条的方法。

能帮助我们吗?

如果您使用的是Apache和Passenger,则可以使用Apache进度条模块。

截屏: http ://www.railsillustrated.com/screencast-file-uploads-progress-in-rails-passenger.html

Apache模块和安装说明: http : //drogomir.com/blog/2008/6/18/upload-progress-bar-with-mod_passenger-and-apache

我过去曾经使用过mongrel_upload_progress ,但我发现这个问题是一个非常复杂而细致的解决方案。 不过,我肯定会建议您在生产环境中使用乘客通过apache。