How can I remove callbacks inserted by vendor code?

早过忘川 提交于 2019-12-06 05:07:58
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

the after_save array is accessible via Model.after_save, it is an array of ActiveSupport::Callbacks::Callback objects. You could run this from within the model

self.after_save.delete_if{|callback| callback.method == :do_something_callback}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!