how to find the cause of ActiveRecord ROLLBACK

后端 未结 4 1855
小鲜肉
小鲜肉 2020-12-07 22:40

In the logs I\'m seeing a ROLLBACK, but no exception is logged. Is there a way to find out what caused the ROLLBACK?

Here\'s the excerpt of the log:

4条回答
  •  独厮守ぢ
    2020-12-07 23:06

    One way is to manually write information to the log. Try something like this from your controller:

    Rails.logger.info(@your_object.errors.inspect) 
    

    That should output the content of all validations that failed.

提交回复
热议问题