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

Add option to set the session middleware when enabling sessions #1161

Merged
merged 4 commits into from
Aug 9, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update sessions documentation in readme
  • Loading branch information
jkowens committed Aug 5, 2016
commit 1c623006dcc8f60679644d83770e4f3fe0a969be
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1413,21 +1413,17 @@ enable :sessions
set :session_store, Rack::Session::Pool
```

Or to enable sessions with a hash of options:
Or to set up sessions with a hash of options:

```ruby
set :sessions, :expire_after => 2592000
set :session_store, Rack::Session::Pool
```

Another option is to **not** call `enable :sessions`, but instead pull in your
middleware of choice as you would any other middleware:
middleware of choice as you would any other middleware.

```ruby
use Rack::Session::Pool, :expire_after => 2592000
```

It is important to note that when using this method, session based protection (see 'Configuring attack protection') will not be enabled by default. The Rack middleware to do that will also need to be added:
It is important to note that when using this method, session based protection (see 'Configuring attack protection') **will not be enabled by default**. The Rack middleware to do that will also need to be added:

```ruby
use Rack::Session::Pool, :expire_after => 2592000
Expand Down