在Rails ActiveAdmin gem中修改BaseController [英] Modifying BaseController in rails ActiveAdmin gem
问题描述
我正在Rails应用程序中使用ActiveAdmin gem。如果我想添加一个适用于所有activeadmin gem的before过滤器,我该怎么做?我想我可以在ActiveAdmin中修改BaseController来实现这一点,但是从rails应用程序进行修改的正确方法是什么?有没有办法复制和覆盖BaseController?
I am using the ActiveAdmin gem in a rails app. If I wanted to add a new before filter that applies to all activeadmin gems, how would I do this? I imagine I could modify the BaseController in ActiveAdmin to achieve this, but what is the proper way to make this modification from within the rails app? Is there a way to duplicate and overwrite the BaseController?
推荐答案
如果我理解您的话,那么有一个特殊的配置
If I understand you , there is a special config for this
# == Controller Filters
#
# You can add before, after and around filters to all of your
# Active Admin resources from here.
#
config.before_filter do
end
您可以在初始化程序/active_admin.rb中找到它
you can find it in initializers/active_admin.rb
这篇关于在Rails ActiveAdmin gem中修改BaseController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!