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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:48:28+00:00 2026-06-10T16:48:28+00:00

Simple question. I have a ActiveRecord model that I want to perform post processing

  • 0

Simple question. I have a ActiveRecord model that I want to perform post processing on AFTER the record is saved. So in the model I have a queue_for_processing method that sticks a job onto my Resque queue. To make this execute after my record is successfully persisted I have written the following in my model:

after_create :queue_for_processing

Pretty simple. I had thought that everything was working as expected EXCEPT that last night my redis server went down and things went awry. My expectations were that the record would still be saved and I could process the job later manually. But the queue_for_processing method is throwing an exception (expected behavior) and stopping the record from saving.

Am I misunderstanding how after_create works? Or is my understanding correct and something funky happening?

Thanks.

  • 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-10T16:48:30+00:00Added an answer on June 10, 2026 at 4:48 pm

    Yes, the callbacks are all wrapped up in a transaction.

    Basically, the following will cause a rollback:

    • return false from before_save or similar callbacks
    • exception in before_save or similar callbacks
    • exception in after_save or similar callbacks (after_create)

    The following do NOT cause a rollback:

    • return false from after_save or similar callbacks
    • exception in after_commit

    If you don’t want an exception to cause a rollback, use after_commit

    • Reference: http://webonrails.com/2012/08/28/activerecord-after_commit-hook/
    • Additional reference: http://guides.rubyonrails.org/v3.1.3/active_record_validations_callbacks.html#transaction-callbacks
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Fairly simple question: I have an init method on my class that has the
So I have a simple post model that has_many tags :through post_tags. This allows
I have a simple database that has the following relation Each Question has one
Simple Rails question. I have a model Foo which looks like this: class Foo
I have a simple question - basically I want to fetch all ActiveRecords of
I have another very puzzling question that has cropped up after my upgrade from
Fairly simple question that I can't remember. We have three environments: Local machine (unique
I have a pretty simple model: class SocialGroup < ActiveRecord::Base validates :name, presence: true
I have a real simple question here. I only want to know if there
A simple question: I have a Model-View-Controller setup, with Models accessing a SQL database.

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.