无法登录到Active Admin [英] Cant login to Active Admin

查看:100
本文介绍了无法登录到Active Admin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我重置&给我的数据库添加种子,它将清除Active Admin的标准admin@example.com登录名。

Every time i reset & seed my database it wipes out the standard admin@example.com login for Active Admin.

在我的种子文件中,我将用户设置为具有角色:admin,但此登录名仅适用于应用程序的前端,不适用于后端活动的admin登录名。我该如何补救?谢谢!

In my seed file i set a user as having role :admin but this login only works for the frontend of the app and not the backend active admin login. How can i remedy this? Thanks!

注意*我使用Devise + cancan + rolify

Note* Im using Devise + cancan + rolify

Seeds.rb

user2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please', :confirmed_at => Time.now.utc
puts 'New user created: ' << user2.name
user.add_role :admin


推荐答案

Active Admin通常为用户提供另一个表,称为admin_users。请在控制台中尝试以下操作

Active Admin generally has another table for users known as admin_users. Please try the following in your console

user = AdminUser.create :email => 'user2@example.com', :password => 'please'

这篇关于无法登录到Active Admin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆