Why does my rails rollback when I try to user.save?

前端 未结 8 1132
北荒
北荒 2020-12-12 16:17

I have installed the RailsTutorial sample app(the twitter like application) and am trying to understand why the following piece of console code does not update the database

8条回答
  •  心在旅途
    2020-12-12 16:44

    Your user model probably has validations which are not satisfied. Since you've not posted those I'm unable to really solve your question. To make live easier you can debug why your user isn't willing to save.

    Try running

    user.errors.full_messages
    

    which should give you a hint what's going wrong.

提交回复
热议问题