0

I'm trying to create a chain of before filter in padrino that look like this of which look like this

before do
  set_current_user
  track_order_ip
  !current_user and pass
  ## don't allow the next filter other filter to run if no current user 
  customer_inactivity!
  skip_enforce!
  ## so the theory is this if a users is is not enforced he should not be allowed to execute enforce! before filter
  enforce!
end

Now all filter would execute in chain but if the current_user is not present I wish to drop(i.e pass) the filter chain processing which is taken care by this (!current_user and pass) code

But trying to do something like this in padrino cause the app to redirect the same route multiple time and then break with following error.

ArgumentError at /myaccount/users/authenticate uncaught throw :pass

at

!current_customer and pass

What I'm find weird and what I'm not able to understand is , why? it not working in Padrino(since I know Padrino internally uses Sinatra) because I did wrote a proof of concept similar application in sinatra (can be found over here) and that just seem to work out of box without any issue

Lastly here the padrino code

Now any one can give me some pointer as too what I'm doing wrong in padrino that is implemented correctly in the proof of concept sinatra app

Thanks

Ratatouille
  • 1,372
  • 5
  • 23
  • 50
  • By the intially look seem to me that using `pass` is not allowed in padrino [here](https://github.com/padrino/padrino-framework/blob/master/padrino-core/lib/padrino-core/application/routing.rb#L719) and [here](https://github.com/padrino/padrino-framework/blob/master/padrino-core/lib/padrino-core/application/routing.rb#L780-L855) look to me like the [process_route](https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L993-L1010) which catch the `pass` is not used at all so pass method is execute but a throw without catch present and error. So it is sinatra but not sinatra :) – Ratatouille Apr 29 '14 at 10:28
  • Do you means if `!current_user`, request stop at here and return something? – dddd1919 Sep 11 '14 at 04:55
  • Thinks [padrino halt](http://www.padrinorb.com/guides/controllers#custom-conditions) may you want – dddd1919 Sep 11 '14 at 05:54

0 Answers0