2016-08-03 85 views
0

我想为admin添加全局的before_filter。在我config/initializers/active_admin.rb我有Activeadmin在过滤器使用前给出运行时错误

config.before_filter :do_something_awesome 

application_controller.rb

def do_something_awesome 
    # raise 
end 

当我尝试启动我的服务器就停止与以下错误。

Exiting 
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:492:in `load_missing_constant': Circular dependency detected while autoloading constant Student (RuntimeError) 

而且还可以我用before_action而不是before_filter由于Rails 4.2不赞成before_filter

回答

2

是的,你可以使用before_action。

+0

谢谢,关于那个错误的任何事情? – user464

+0

你能告诉我routes.rb文件吗? –

+0

查看此链接以更好地了解错误,http://neethack.com/2015/04/rails-circular-dependency/ –

相关问题