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(" Sessions are not enabled. To use `\#{session_method}`:\n\n Configure sessions in your Hanami app, e.g.\n\n module MyApp\n class App < Hanami::App\n # See Rack::Session::Cookie for options\n config.sessions = :cookie, {**cookie_session_options}\n end\n end\n\n Or include session support directly in your action class:\n\n include Hanami::Action::Session\n TEXT\nend\n") |