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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:15:03+00:00 2026-05-17T19:15:03+00:00

My question is similar to this one How to skip ActiveRecord callbacks? but instead

  • 0

My question is similar to this one How to skip ActiveRecord callbacks? but instead of AR I’m using Mongoid, It seems like that isn’t implemented yet in the current version of Mongoid, so I’d like to know what should be an elegant solution to implement it. (if necessary).

  • 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-17T19:15:04+00:00Added an answer on May 17, 2026 at 7:15 pm

    Yes you can!

    Mongoid is built on ActiveModel and ActiveModel has a skip_callback function. You can use skip_callback like this:

    # skip the callback
    MyModelClass.skip_callback(:save, :before, :ensure_foo_is_not_bar)
    
    # rescue any errors to ensure callback is restored afterwords
    begin
      my_model_instance.update_attributes :foo => 'bar'
    rescue
      puts "Error from 'my_model_instance.update_attributes': #{$!}"
    end
    
    # restore the callback for future calls
    MyModelClass.set_callback(:save, :before, :ensure_foo_is_not_bar)
    

    I’m using this without a hitch in a big app. For more info, see this blog post by Jeff Kreeftmeijer:

    http://jeffkreeftmeijer.com/2010/disabling-activemodel-callbacks/

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

Sidebar

Related Questions

Similar question as this one but for a Microsoft Environment. Email --> Exchange Server
I've seen a few similar questions to this one, but none that were quite
I asked a similar question about this previously, but I did not specify that
I asked a question similar to this one a couple of weeks ago, but
I have a similar question to this one SQL products/productsales I want to do
Liu Chang asked a very similar question to this one here, Linux equivalent of
Perhaps my question is similar in nature to this one: Do you use design
Similar questions to this one have been asked but none seem to address my
Similar to this question, but for VB.NET since I learned this is a language
Note this question is similar this one except I'm not working with linq-to-sql, so

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.