1. Putting sessions in the database

rake db:sessions:create

result:

image

then we need to apply the migration to add the table to our schema

rake db:migrate

2. Tell Rails to use database storage for our App.

2.1 go to “config/environment.rb”

image

you need to un-comment this line

config.action_controller.session_store = :active_record_store

And then you are ready to use the session in your application now.

Created by “WhenURnotAround”

reference from Agile web development with rails