heroku db:push 奇怪的东西
因此,当我在本地 RoR 应用程序上创建一个帐户,然后使用 heroku db:push
将其推送到 heroku 时,一切都很好。但是,当我在控制台本地使用 User.find(5).toggle!(:admin)
将我的帐户设置为管理员,然后将数据库推送到 heroku 时,我无法再登录我的帐户。我收到的密码和电子邮件组合不正确。这是为什么呢?
So when I create an account on my RoR app locally, and then push it to heroku with heroku db:push
all is well. 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在教程中遇到了同样的问题。
当您使用切换更新该管理员用户时,它还会根据教程的逻辑更新密码盐。因此,您正确设置的密码将不起作用。解决方案是检查您的密码加盐方法并更改您的加盐逻辑或将其发布到此处。
您可以通过进入 Heroku ruby 控制台并在切换之前和切换后记录用户的盐来检查是否属于这种情况。如果你有和我一样的问题,他们会有所不同。
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.
您在本地计算机上使用的数据库很可能是development.db,根据您的配置,它可能会也可能不会被推送到heroku。查看这篇文章,了解有关如何指定要推送到 Heroku 的数据库的更多信息。
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.