Module: Lotus::Action::Session
- Defined in:
- lib/lotus/action/session.rb
Overview
Session API
This module isn’t included by default.
Constant Summary collapse
- SESSION_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The key that returns raw session from the Rack env
'rack.session'.freeze
- ERRORS_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The key that is used by flash to transport errors
:__errors
Class Method Summary collapse
-
.included(action) ⇒ Object
private
Add session to default exposures.
Instance Method Summary collapse
-
#session ⇒ Hash
Gets the session from the request and expose it as an Hash.
Class Method Details
.included(action) ⇒ Object
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.
Add session to default exposures
27 28 29 30 31 |
# File 'lib/lotus/action/session.rb', line 27 def self.included(action) action.class_eval do expose :session end end |
Instance Method Details
#session ⇒ Hash
Gets the session from the request and expose it as an Hash.
60 61 62 |
# File 'lib/lotus/action/session.rb', line 60 def session @_env[SESSION_KEY] ||= {} end |