Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

skip_before_filter based on 'request'

I would like to invoke a skip_before_filter based on 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.

like image 215
Kris Avatar asked Mar 22 '26 17:03

Kris


1 Answers

This should work

skip_before_filter :authorize_user, :if => Proc.new {|c| c.request.remote_ip == '127.0.0.1'}
like image 199
egze Avatar answered Mar 25 '26 09:03

egze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!