过滤前使用Active Admin跳过 [英] Skip before filter with Active Admin

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

问题描述

我正在使用devise,最近添加了一个活动的管理员,它创建了一个单独的admin_users表来保存管理员。

I am using devise and recently added active admin, which created a separate table of admin_users to keep admins.

当我尝试登录时,Active Admin可以正常工作进来浏览。但是,我的应用程序控制器对于一般用户来说是这样的:

All works fine with Active Admin when I try to log in and browse around. However, my application controller has this for general users:

before_filter :authenticate_user!, :except => [:show, :index]

正因为如此,当在活动的管理界面内时,编辑或删除任何东西,它要求我登录。我了解到,在控制器中可以使用skip_before_filter,其中需要排除before_filter,但是Active Admin在控制器文件夹或任何位置上没有控制器文件我可以看看我的项目。

Because of this, when inside the active admin interface, whenever I try to edit or delete anything, it asks me to log in. I learned that a skip_before_filter can be used inside the controller in which the before_filter needs to be excluded, however Active Admin doesn't have a controller file in the controllers folder or anywhere in my project I could look.

任何人都可以建议如何使活动管理员忽略应用程序beofre_filter,我想应用于所有的客户端/用户面对?

can anyone suggest how to make active admin ignore the application beofre_filter which I want to apply on all of the client/user facing?

推荐答案

config / initializers / active_admin.rb 中,您可以添加以下内容: / p>

In config/initializers/active_admin.rb you can add the following:

config.skip_before_filter :authenticate_user!

您还可以使用提供的DSL修改ActiveAdmin控制器: http://activeadmin.info/docs/8-custom-actions.html#modify_the_controller

You can also use the DSL provided to modify the ActiveAdmin controller: http://activeadmin.info/docs/8-custom-actions.html#modify_the_controller

这篇关于过滤前使用Active Admin跳过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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