Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 没有设计,ActiveAdmin无法工作_Ruby On Rails_Devise_Activeadmin - Fatal编程技术网

Ruby on rails 没有设计,ActiveAdmin无法工作

Ruby on rails 没有设计,ActiveAdmin无法工作,ruby-on-rails,devise,activeadmin,Ruby On Rails,Devise,Activeadmin,因此,我们刚刚经历了删除Desive的过程,并推出了简单的bcrypt+cancancanauth系统 现在我们还使用ActiveAdmin作为web应用程序管理部分的解决方案,该解决方案与design相关联。web应用程序的该部分上的所有内容都已损坏:) 我尝试了几种不同的方法来解决添加我们自己的身份验证方法的问题,但我无法找到路由和其他需要的解决方案 我们有一个AdminUser模型,应该是管理员用户。我确实将其“转换”为使用普通用户用于密码的列(在我们切换到bcrypt之后),但我完全不知

因此,我们刚刚经历了删除Desive的过程,并推出了简单的
bcrypt
+
cancancan
auth系统

现在我们还使用
ActiveAdmin
作为web应用程序管理部分的解决方案,该解决方案与
design
相关联。web应用程序的该部分上的所有内容都已损坏:)

我尝试了几种不同的方法来解决添加我们自己的身份验证方法的问题,但我无法找到路由和其他需要的解决方案


我们有一个
AdminUser
模型,应该是管理员用户。我确实将其“转换”为使用普通用户用于密码的列(在我们切换到bcrypt之后),但我完全不知道如何使用ActiveAdmin。

config/initializers/active\u admin.rb
中,您可能需要重新配置一些项

您可能需要定义身份验证方法:

# config/initializers/active_admin.rb

# == User Authentication
#
# Active Admin will automatically call an authentication
# method in a before filter of all controller actions to
# ensure that there is a currently logged in admin user.
#
# This setting changes the method which Active Admin calls
# within the application controller.
config.authentication_method = :authenticate_active_admin_user!

# app/controllers/application_controller.rb
def authenticat_active_admin_user!
  # Something that returns true if the current user has access to active admin
end
您可能还需要设置
当前用户
方法:

# config/initializers/active_admin.rb

# == Current User
#
# Active Admin will associate actions with the current
# user performing them.
#
# This setting changes the method which Active Admin calls
# (within the application controller) to return the currently logged in user.
config.current_user_method = :current_user

# app/controllers/application_controller.rb
def current_user
  # returns the current logged in user.  Devise provides this automatically. You will need to replace that functionality.
end
以上只是活动管理初始值设定项中影响登录和身份验证的两件事。我建议通读全文,并查看与用户身份验证和授权相关的所有其他配置。初始值设定项有很好的文档记录和注释,在活动管理中有很多文档。您可能会发现需要替换active admin用于身份验证和授权的其他一些方法


最后,确保您的CanCanCan
能力
类能够访问当前用户。如果您的控制器没有将其传递给正确的用户,那么它将阻止访问。

这是一个广泛的问题,我发布了一个广泛的答案。如果您能更具体地说明您遇到的确切错误,我可能会提供更准确的帮助。