-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add option to set the session middleware when enabling sessions #1161
Conversation
By setting the session middleware as an option, rack protection for sessions will be enabled by default and other session settings will be applied to the middleware.
|
||
```ruby | ||
use Rack::Session::Pool, :expire_after => 2592000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the use
example still works I'd like to show both (since both should be supported).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call 👍
@zzak I think I've just thought of a better way to handle setting a custom session middleware. What do you think about this:
If someone needed to set an option on the session middleware they could do this:
|
@jkowens I think you're on the right track, let me know what you come up with after some polish :) |
b59a765
to
4ee4b81
Compare
4ee4b81
to
db0f8d5
Compare
@zzak ok I think I'm ready for you to give it another look. Hopefully the documentation is up to snuff. Thanks! |
I will squash my commits once everything is good. |
set :session_store, Rack::Session::Pool | ||
``` | ||
|
||
Or to enable sessions with a hash of options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using "enable" here is slightly confusing because enable
is a method too, mentioned above
d5eaa96
to
593cb37
Compare
@jkowens LGTM thanks for your patience and contribution! |
Cool, thanks for your help 😄 |
By setting the session middleware as an option, rack protection for
sessions will be enabled by default and other session settings will be
applied to the middleware. Fixes #1038.
Example: