2016-08-03 42 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/ –

相關問題