Exception: Hanami::Action::MissingSessionError
- Defined in:
- lib/hanami/action/errors.rb
Overview
Error raised when session is accessed but not enabled.
This error is raised when ‘session` or `flash` is accessed/set on request/response objects in actions which do not include `Hanami::Action::Session`.
Instance Method Summary collapse
-
#initialize(session_method) ⇒ MissingSessionError
constructor
private
A new instance of MissingSessionError.
Constructor Details
#initialize(session_method) ⇒ MissingSessionError
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MissingSessionError.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/hanami/action/errors.rb', line 76 def initialize(session_method) super(<<~TEXT) Sessions are not enabled. To use `#{session_method}`: Configure sessions in your Hanami app, e.g. module MyApp class App < Hanami::App # See Rack::Session::Cookie for options config.sessions = :cookie, {**cookie_session_options} end end Or include session support directly in your action class: include Hanami::Action::Session TEXT end |