I have some models that have after_save callbacks. Usually that's fine, but in some situations, like when creating development data, I want to save the models without having the callbacks run. Is there a simple way to do that? Something akin to...
Person#save( :run_callbacks => false )
I looked in the Rails docs and didn't find anything. However in my experience the Rails docs don't always tell the whole story.
I found a blog post that explains how you can remove callbacks from a model like this:
I couldn't find where that method is documented but it seems to work.
This solution is Rails 2 only.
I just investigated this and I think I have a solution. There are two ActiveRecord private methods that you can use:
You're going to have to use send to call these methods. examples:
p = Person.new(:name => 'foo')
p = Person.find(1)
This is definitely something that you'll only really want to use in the console or while doing some random tests. Hope this helps!