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

Be careful when using the 'shotgun' gem #7

Open
alssndro opened this issue Feb 25, 2014 · 7 comments
Open

Be careful when using the 'shotgun' gem #7

alssndro opened this issue Feb 25, 2014 · 7 comments

Comments

@alssndro
Copy link

For anyone else who made this oversight while using Shotgun, be warned that sinatra-flash appears as though it isn't working, but really it is.

I'm assuming this is because Shotgun reloads the entire Sinatra app on each request, so sessions weren't working as they would normally.

So don't use shotgun while testing, use webbrick/unicorn/any other server.

Hopefully this saves someone else a lot of time!

P.S Maybe worth mentioning in the README somewhere?

@rchampourlier
Copy link

"Hopefully this saves someone else a lot of time!"

Yes, saved me!

@fetmar
Copy link

fetmar commented Aug 9, 2014

You saved me whatever I was about to spend after an evening and a morning of wondering what on Earth was happening to my brain. Thank you!

@josemotanet
Copy link

😆 I can't believe I felt into this. Thanks for letting the issue open so dumb guys like me can appreciate your remark.

@odigity
Copy link

odigity commented Sep 27, 2015

Does anyone know why this is happening? It's not obvious to me that merely reloading the app on each request should cause this problem. The flash content is stored in a session cookie, which will be sent back to the app on the next request. The fact that the app was reloaded in between requests should not break anything.

@josemotanet
Copy link

I think that, because shotgun reloads the entire app (does it spawn a new one? I'm not sure), the cookies on the server side are lost since it's the one that issues those cookies in the first place; at least, regarding flash messaging. Only when the HTTP response is returned, the cookie is stored. Because the process is interrupted in each request, redirection and message passing fail.

@gnfisher
Copy link

Thank you for this. I was going a little crazy wondering why the flash hash was empty in my view!

@inem
Copy link

inem commented Nov 6, 2017

Here's workaround that worked for me. Just add set :session_secret, "something" to your app.

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

7 participants