In rails, how can I find out what caused a .save() to fail, other than validation errors?

前端 未结 5 1315
天涯浪人
天涯浪人 2020-12-24 11:18

I have an ActiveRecord model which is returning true from valid? (and .errors is empty), but is returning false from save()

5条回答
  •  悲哀的现实
    2020-12-24 11:46

    If @user.save (for example) returns false, then just run this to get all the errors:

    @user.errors.full_messages
    

提交回复
热议问题