heroku db:push weird thing
So when I create an account on my RoR app locally, and then push it to heroku with heroku db:push
all is well.开发者_StackOverflow社区 However, when I make my account an admin with User.find(5).toggle!(:admin)
locally in the console and then push the db to heroku, I can no longer log into my account. I get an incorrect pw and email combo. Why is this?
I had this same problem with a tutorial.
When you update that admin user with toggle, it also updates the password salt based on the logic of the tutorial. As a result, the password you setup correctly won't work. The solution is to check your password salting methods and change your salting logic or post it here.
You can check to see if this the case yourself by going into the heroku ruby console and recording the user's salt prior to a toggle and post-toggle. If you have the same problem I had they will be different.
the database you use on your local computer is most likely the development.db, which depending on your configuration may or may not have been pushed to heroku. check out this article for more info on how to specify which database you want to push to heroku.
精彩评论