无法使用 ActiveAdmin 创建新用户 [英] Can't create new user with ActiveAdmin
本文介绍了无法使用 ActiveAdmin 创建新用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚在 Rails 应用中添加了活动管理员,但无法创建新用户.我正在使用活动管理员创建的用户模型,其中添加了一些列,如名字和姓氏.当我为新用户填写表单并单击创建新用户时,该页面会刷新但不会保存我的用户,也不会转到包含成功消息的概述页面.
I just added active admin to my rails app and I'm unable to create a new user. I am using the user model that active admin creates with a few added columns like first and last name. When I fill out the form for a new user and click create new user, that page refreshes but doesn't save my user and doesn't go to the recap page with the successful message.
这是我的 AdminUser 模型
here is my AdminUser model
class AdminUser < ActiveRecord::Base
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name
end
这是我的活跃管理员课程
And here is my active admin class
ActiveAdmin.register AdminUser do
index do
column :first_name
column :last_name
column :email
default_actions
end
form do |f|
f.inputs "User Details" do
f.inputs :email
f.inputs :first_name
f.inputs :last_name
end
f.buttons
end
end
推荐答案
忘记把这个小家伙加到模型里了...fml
Forgot to add this little guy to the model...fml
after_create { |admin| admin.send_reset_password_instructions }
def password_required?
new_record? ? false : super
end
这篇关于无法使用 ActiveAdmin 创建新用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文