How do I 'validate' on destroy in rails

前端 未结 11 1909
你的背包
你的背包 2020-11-28 06:33

On destruction of a restful resource, I want to guarantee a few things before I allow a destroy operation to continue? Basically, I want the ability to stop the destroy oper

11条回答
  •  生来不讨喜
    2020-11-28 07:28

    The ActiveRecord associations has_many and has_one allows for a dependent option that will make sure related table rows are deleted on delete, but this is usually to keep your database clean rather than preventing it from being invalid.

提交回复
热议问题