How do I find out why I couldn't #destroy() a record?

前端 未结 5 1257
陌清茗
陌清茗 2021-02-01 15:16
person = Person.find(4123)
person.destroy #=> false

What ways do I have to find out why the record wasn\'t deleted? The model has two validations, b

5条回答
  •  名媛妹妹
    2021-02-01 15:40

    This error is usually raised due to a dependent: :restrict_with_error specified on an association in the model. Run a quick search for this in your model definition (as well as associated model definitions) and see if that's the case.

提交回复
热议问题