Skip to content
Max Ivak edited this page Jul 3, 2016 · 2 revisions

Sessions

Store session in database

  • Session data is stored in DB

  • config/initializers/session_store.rb

Rails.application.config.session_store :active_record_store
  • use gem 'activerecord-session_store'
# Gemfile
gem 'activerecord-session_store', github: 'rails/activerecord-session_store'
  • table in database can be created with rake command:
rails g active_record:session_migration

rake db:migrate

which will create table 'sessions'.

Store session in Redis

as alternative we can store session data in Redis.

Clone this wiki locally