views:

191

answers:

2

Hey. I would like to upload a file and then parse it. Because parsing can take up to 10min I installed delayed_job plugin and called parsing function through send_later function. I have to mention that this is an AJAX app.

Imagine that you press an AJAX button that starts upload and after that the source is imported into the database. During the process I want to show the progress bar or message (importing...) and when it completes the task status changes to done.

My question is: What is the best way to check for status of the process. What would you do? My idea is to have another controller actions "status" which look into the database and provide the right status.

+1  A: 

For me it's the good way.

shingara
+1  A: 

I made a plugin for rails because I had the same problem as you. It automates most of the code to manage a background task from the browser (check status, etc,.).

Check it out here: http://github.com/chrismoos/ajaxtask

How it works: http://chrismoos.com/2010/02/09/ajaxtask-a-rails-plugin-for-managing-background-tasks/

chris.moos