I cannot get into admin panel after updating my activeadmin, my admin users are store in a table called admin_users.
在更新我的activeadmin之后,我无法进入admin面板,我的admin用户存储在一个名为admin_users的表中。
NoMethodError in Admin::DashboardController#index
undefined method `authenticate_admin_user!' for #Admin::DashboardController:0x007fe46c3d99d0
Rails.root: /Users/jianbo/Documents/Aptana Studio 3 Workspace/iv
Application Trace | Framework Trace | Full Trace
activeadmin (0.6.2) lib/active_admin/base_controller.rb:40:in authenticate_active_admin_user'
activesupport (3.2.15) lib/active_support/callbacks.rb:474:inblock in run_3994836635519503653__process_action__2211030722258422070__callbacks'
activesupport (3.2.15) lib/active_support/callbacks.rb:215:in `block in conditionalcallback_around_863'
1 个解决方案
#1
3
As part of ActiveAdmin configuration you need to define a method on ApplicationController that requires authentication and determines whether the user is an admin (and hence can access ActiveAdmin pages). The name of this method can be controlled by this setting in the ActiveAdmin initializers:
作为ActiveAdmin配置的一部分,您需要在ApplicationController上定义一个方法,该方法需要进行身份验证并确定用户是否是admin(因此可以访问ActiveAdmin页面)。此方法的名称可由ActiveAdmin初始化器中的此设置控制:
config.authentication_method = :authenticate_admin_user!
The default name for this method is authenticate_admin_user!
此方法的默认名称是authenticate_admin_user!
If you already have a method that authenticates a user and confirms that they are an admin, just update the config to use that method. Otherwise you'll need to create this method on the ApplicationController
如果您已经有了一个验证用户并确认他们是admin的方法,只需更新配置以使用该方法。否则,您需要在ApplicationController上创建此方法
#1
3
As part of ActiveAdmin configuration you need to define a method on ApplicationController that requires authentication and determines whether the user is an admin (and hence can access ActiveAdmin pages). The name of this method can be controlled by this setting in the ActiveAdmin initializers:
作为ActiveAdmin配置的一部分,您需要在ApplicationController上定义一个方法,该方法需要进行身份验证并确定用户是否是admin(因此可以访问ActiveAdmin页面)。此方法的名称可由ActiveAdmin初始化器中的此设置控制:
config.authentication_method = :authenticate_admin_user!
The default name for this method is authenticate_admin_user!
此方法的默认名称是authenticate_admin_user!
If you already have a method that authenticates a user and confirms that they are an admin, just update the config to use that method. Otherwise you'll need to create this method on the ApplicationController
如果您已经有了一个验证用户并确认他们是admin的方法,只需更新配置以使用该方法。否则,您需要在ApplicationController上创建此方法