instance method session_store

Ruby on Rails 7.2.3

Since v3.0.20

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

session_store(new_session_store = nil, **options)

Specifies what class to use to store the session. Possible values are :cache_store, :cookie_store, :mem_cache_store, a custom store, or :disabled. :disabled tells Rails not to deal with sessions.

Additional options will be set as session_options:

config.session_store :cookie_store, key: "_your_app_session"
config.session_options # => {key: "_your_app_session"}

If a custom store is specified as a symbol, it will be resolved to the ActionDispatch::Session namespace:

# use ActionDispatch::Session::MyCustomStore as the session store
config.session_store :my_custom_store

Parameters

new_session_store opt = nil
options keyrest
Source
# File railties/lib/rails/application/configuration.rb, line 540
      def session_store(new_session_store = nil, **options)
        if new_session_store
          @session_store = new_session_store
          @session_options = options || {}
        else
          case @session_store
          when :disabled
            nil
          when Symbol
            ActionDispatch::Session.resolve_store(@session_store)
          else
            @session_store
          end
        end
      end

Defined in railties/lib/rails/application/configuration.rb line 540 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Application::Configuration

Type at least 2 characters to search.

↑↓ navigate · open · esc close