Sha256: f073af710102e98c86776d9b7e5c8b3eace0b634f3a647f8116de6664c8a7a69

Contents?: true

Size: 703 Bytes

Versions: 21

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

module NeetoCommonsBackend
  module Initializers
    class << self
      def session_store(expire_after = 1.days.to_i)
        Rails.application.config.session_store(
          :active_record_store,
          key: Rails.application.secrets.session_cookie_name, expire_after:)

        ActiveRecord::SessionStore::Session.table_name = "server_side_sessions"
        ActiveRecord::SessionStore::Session.primary_key = "session_id"
        ActiveRecord::SessionStore::Session.serializer = :json

        Rails.application.config.after_initialize do
          ActionDispatch::Session::ActiveRecordStore.session_class = ServerSideSession
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
neeto-commons-backend-1.0.89 lib/neeto_commons_backend/initializers/session_store.rb