问题描述
|
如果要创建或销毁记录,将触发哪个Rails回调?
解决方法
假设您指的是使用ActiveRecord(Rails的默认ORM)的用法,则要查找的回调是:
唱片制作
before_create
around_create
after_create
记录销毁
before_destroy
around_destroy
after_destroy
您可以在以下主题的Rails指南中找到高质量的文档:http://guides.rubyonrails.org/active_record_validations_callbacks.html