Class: Booth::Hooks::SerializeFromSession
- Inherits:
-
Object
- Object
- Booth::Hooks::SerializeFromSession
- Includes:
- Logging, Calls
- Defined in:
- lib/booth/hooks/serialize_from_session.rb
Overview
Convert what is in the cookie to a session record from the DB.
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/booth/hooks/serialize_from_session.rb', line 12 def call ::Booth::Syntaxes::Uuid.call(session_id, raise_if_invalid: true) session = ::Booth::Models::Session.active_scope .includes_scope .find_by(id: session_id) unless session log { "Session ID #{session_id.inspect} stored in cookie doesn't exist in database" } # p ::Booth::Models::Session.find_by(id: session_id) return end log { "Deserializing DB Session #{session_id.inspect} information into Warden cookie..." } ::Booth::Core::Sessions::ToPassport.call(session) end |