-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch back to cookie_store for sessions
Storing in database results in a giant table that needs pruning etc.
- Loading branch information
Showing
3 changed files
with
18 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# Be sure to restart your server when you modify this file. | ||
|
||
#Rails.application.config.session_store :cookie_store, key: '_tess_sessions' | ||
Rails.application.config.session_store :active_record_store, key: '_tess_sessions', secure: Rails.env.production? | ||
|
||
|
||
opts = Rails.env.production? ? { same_site: :strict, secure: true } : {} | ||
Rails.application.config.session_store :cookie_store, **opts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class DropSessions < ActiveRecord::Migration[7.0] | ||
def up | ||
drop_table :sessions | ||
end | ||
|
||
def down | ||
create_table :sessions do |t| | ||
t.string :session_id, null: false | ||
t.text :data | ||
t.timestamps | ||
end | ||
|
||
add_index :sessions, :session_id, unique: true | ||
add_index :sessions, :updated_at | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters