Can't log into Active Admin. Any way to create an admin user? [closed]

寵の児 提交于 2020-01-12 07:56:08

问题


When I try to log in with the default admin user, I get "invalid email or password." Is there a way to create a user with code and try to log in that way?

I can log in on my live website, but not locally. My development code matches exactly what is on production.


回答1:


You can run a rails console on your development server, and create a new admin user in the console itself.

The following is a typical sequence of such commands (change them according to your setup):

user = AdminUser.new
user.email = "<your email>"
user.password = "<your password>"
user.save

That will create the required admin for you. :)




回答2:


another way is to place this file into db directory and then run

rake db:seed

or in console

Rails.application.load_seed 

there you can see how AdminUser is created, as well



来源:https://stackoverflow.com/questions/20447006/cant-log-into-active-admin-any-way-to-create-an-admin-user

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