开发者

skip_before_filter based on 'request'

开发者 https://www.devze.com 2023-02-14 16:07 出处:网络
I would like to invoke a skip_before_filter based 开发者_如何学Pythonon the request object. pseudo code:

I would like to invoke a skip_before_filter based 开发者_如何学Pythonon the request object.

pseudo code:

skip_before_filter :authorize_user, :if => lambda { |controller| controller.request.ip == '127.0.0.1'

Is this possible, it seems you only get :only/:except with skip_filter's.


This should work

skip_before_filter :authorize_user, :if => Proc.new {|c| c.request.remote_ip == '127.0.0.1'}
0

精彩评论

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