Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:02:43+00:00 2026-06-04T15:02:43+00:00

I’m using delayed job for some carrierwave tasks which can take some time. At

  • 0

I’m using delayed job for some carrierwave tasks which can take some time.

At the moment I have created a simple job with a hook on success, it looks like this:

class VideoclipDownloadJob

  def initialize(video_id)
    @video_id = video_id
  end

  def perform
    Videoclip.grab_videoclips(@video_id)
  end

  def success(job)
    Rails.logger.info { "Videoclip downloads for video: #{@video_id} complete" }
    Video.find(@video_id).update_attribute(:videoclips_downloaded, Time.now)
  end

end

It works OK and I have currently implemented some AJAX polling in the browser to check when the job is complete and redirect.

However, I have two issues with this approach and would love to get some advice on this.

Firstly, if a user does not have javascript currently there is no way of redirecting them after the job is complete.

Therefore I would ideally like to include a redirect_to in the success hook in my job. I tried to add this directly into the success(job) method without success and also to create a method in my model to do it.

At that point it made me realise that it does not seem like a good MVC pattern.

Should I therefore rely purely on javascript or is there a better alternative?

My second question relates more to using Carrierwave.

It is working fine for the basic transferring of files, but the files can be quite large and I would really like to be able to not only show two states… downloading and complete, but also a progress (in percentage) of the actual transfer.

On the client side I can poll this information in the same way as I am for the jobs.

BUT – I cannot find in the Carrierwave documentation any mention of a way to find out the specific progress of an uploader.

Any advice on the best ways to achieve these two things would be very much appreciated.

Thanks,

Chris

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:02:45+00:00Added an answer on June 4, 2026 at 3:02 pm

    redirect_to is a response to a browser/js request. When you have scheduled a background job and JS is disabled, you cannot redirect the user if his browser has not made any new request. And if you redirect him when his browser makes a new request, it may not be such a good idea because you may be interrupting his work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.