Devise Admin Role: PG::Error: ERROR: relation “admins” already exists

匿名 (未验证) 提交于 2019-12-03 01:34:02

问题:

After successfully configuring devise with users I am now trying to add an Admin role in preparation of using rails_admin.

I followed these instructions (https://github.com/plataformatec/devise/wiki/How-To:-Add-an-Admin-role) to add the admin role to devise even though the migration generated looked completely different from that in the instructions. I then ran "bundle exec rake db:migrate" only to get the error:

PG::Error: ERROR:  relation "admins" already exists 

At this point I had not attempted to install rails_admin because I wanted to get devise working fully first.

Any ideas why I got this error when I did not previously have an admin model?

回答1:

Solution thanks to wildplasser: run db:drop -> db:create -> db:migrate to reset the database!



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!