How to remove callbacks inserted by provider code?

I am using inserts after_save callback that I would like to remove. It seems to me that it would be easier to remove the character from the array than to fix the problem with monkeypatch. How can I access the callback array?

+2
callback ruby-on-rails controller
source share
2 answers
class UserSession < Authlogic::Session::Base # Don't use cookie AuthLogic behaviour skip_callback :persist, :persist_by_cookie skip_callback :after_save, :save_cookie skip_callback :after_destroy, :destroy_cookie end 
+9
source share

the after_save array is accessible through Model.after_save , it is an array of ActiveSupport::Callbacks::Callback objects. You can run it from the model.

 self.after_save.delete_if{|callback| callback.method == :do_something_callback} 
+2
source share

All Articles