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 6781405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:37:12+00:00 2026-05-26T16:37:12+00:00

I want to run a cron rake task every time a record is updated

  • 0

I want to run a cron rake task every time a record is updated – i.e. some time after the new record is created/updated, a cron rake task will do some processing on the record and save the results.

However, this task is processor intensive and it makes sense to run it only when the record is updated by the user.

What is the best way programmatically to determine if the rake task has already processed a specific record (and the user has not changed it at all)?

I’m thinking of generating a hash for each record and using it to see if it has changed. There must be a more efficient way to perform this.

Thanks for the help,
Alex

  • 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-05-26T16:37:13+00:00Added an answer on May 26, 2026 at 4:37 pm

    I think you should use DelayedJob rather than Cron/Whenever.

    Anyway, don’t you think it would be better to do it in validation or as before/after save filter? If you implemented this functionality as before_save filter, then you could use dirty attributes. More about dirty attributes you can find here: http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects

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

Sidebar

Related Questions

I want to run a cron job every minute that will launch a script.
I want to run a cron and compress my /var/log directory every hour to
I want to set a cron run after an other cron. For example: Cron
I have a bash script I want to run every 5 minutes from cron...
Simple question: I want to run a cron operation every minute at the 10th
I have developed a job which I want to run say after every 5
I want set run a file with cron at 12:03:37 every day. How do
I want to run a task every minute on Heroku to check if conditions
I want to setup rake tasks to run via cron. That is easy, but
I want to run a background task that reads input from a TextReader and

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.