1

コントローラーで Python スクリプトを実行する必要があり、タスクに 2 分かかる場合があります。コマンドラインで進行状況を出力できます。印刷を使用するだけです。しかし、ユーザーに進行状況を知らせるために、進行状況情報をビューに出力する方法がわかりません。

ありがとう〜

4

1 に答える 1

1

ストリーミングを使用できます

コントローラ

class PostsController
  def index
    # your python script
    render stream: true
  end
end

application.html.erb

<html>
  <head><title>  <%= provide :title, "Main" %></title></head>
  <body><%= yield %></body>
</html>

投稿/index.html.erb

<%= content_for :title, " your python results" %>
于 2013-08-15T06:05:51.250 に答える