How can I avoid running ActiveRecord callbacks?
It's often useful to disable ActiveRecord callbacks such as :after_save when migrating data. It's rather easy to do:
Foo.after_create.clear
Foo.after_save.clear
... migration code ...
If you only need to disable certain actions, it's also trivial:
Foo.after_save.reject! {|callback| callback.method.to_s == 'some_method_name' }
This sort of thing should never be used in application code, if you're doing this then your model is broken. However, it's great for data migrations.