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

前端 未结 5 1161
陌清茗
陌清茗 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:27

    What version Rails are you on? In Rails 4, you can force a destroy using person.destroy!. If the action fails, a traceback will be displayed.

提交回复
热议问题