开发者

Global before_filter in rails

开发者 https://www.devze.com 2023-01-25 16:40 出处:网络
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.

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

精彩评论

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

关注公众号