开发者

Global before_filter in rails

I need to execute a method before certains actions in a rails app and apparently the right way to go is using a before_filter.

The before_开发者_如何转开发filter works fine when a put the filter method in the controller, but I need to use this filter in all the controllers, and I don't think would be right repeat the filter code en each one of them. So, I moved the code to the application controller, but it stopped work.

I don't know if I'm calling it wrongly, I don't know. What is the right way to do this?

PD: I call the filter this way

:before_filter => :get_language


try before_filter not :before_filter (symbol)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜