如何删除供应商代码插入的回调?
我正在使用的 gem 插入了一个我想删除的 after_save 回调。在我看来,从数组中删除符号比用猴子补丁修复问题更干净。如何访问回调数组?
A gem I am using inserts an after_save callback that I would like to remove. It seems to me it would be cleaner to delete a symbol from an array than to fix the problem with a monkeypatch. How can I access the array of callbacks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
after_save
数组可通过Model.after_save
访问,它是ActiveSupport::Callbacks::Callback
对象的数组。您可以从模型内运行它the
after_save
array is accessible viaModel.after_save
, it is an array ofActiveSupport::Callbacks::Callback
objects. You could run this from within the model