Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running code before redirect not working #70

Closed
abhasg opened this issue Apr 1, 2014 · 3 comments
Closed

Running code before redirect not working #70

abhasg opened this issue Apr 1, 2014 · 3 comments

Comments

@abhasg
Copy link

abhasg commented Apr 1, 2014

Hi

I am using rails 3.2.17 and ruby 1.9.3-p484, when I tried to keep the flash with method you have given in README section Running code before redirect not working its giving @request variable as nil object. Here is my application code:-

config.middleware.use Rack::SslEnforcer, :only => [%r{^/bla/bla/bla/}], :mixed => true, :before_redirect => Proc.new { #keep flash on redirect @request.session[:flash].keep if [email protected]? && @request.session.key?('flash') && [email protected]['flash'].empty? }

Using rack-ssl-enforcer 0.2.6 getting error undefined method "session" for nill Class. Tried to inspect the @request object in Proc it is giving nil. Can you please help me with this issue?

@rymai
Copy link
Collaborator

rymai commented Apr 1, 2014

You're probably right, the @request object doesn't exist in the context of the proc... @oveddan what do you think?

abhasg pushed a commit to abhasg/rack-ssl-enforcer that referenced this issue Apr 2, 2014
@abhasg
Copy link
Author

abhasg commented Apr 2, 2014

I have sent a pull request so that it will run properly. Have a look if that solution can be used. Will be waiting for your response.

tobmatth added a commit that referenced this issue Apr 22, 2014
Fixing issue #70 - Running code before redirect not working
@tobmatth
Copy link
Owner

Merged in, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants