开发者

multiple routing filter in rails 3

开发者 https://www.devze.com 2023-02-26 02:07 出处:网络
I\'m already using :before_filte开发者_如何学运维r :authenticate_user! from devise but I would like to add another filter in my controllers after authenticate_user! passes. After the user authenticate

I'm already using :before_filte开发者_如何学运维r :authenticate_user! from devise but I would like to add another filter in my controllers after authenticate_user! passes. After the user authenticates I would like to check if some attribute in User is set to true, if not then I would like to redirect the user to some page.

Is there some guide or plugin to create a custom filter?


You can add another before_filter to your controller. A filter stops the chain if and only if it redirects or renders something, otherwise the next filter is executed.

See more on filters in the RailsGuides: http://guides.rubyonrails.org/action_controller_overview.html#filters

0

精彩评论

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