Module: DemoMode::Demoable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/demo_mode/demoable.rb
Instance Method Summary collapse
Instance Method Details
#current_demo_session ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/concerns/demo_mode/demoable.rb', line 12 def current_demo_session if session.key?(:demo_session) @current_demo_session = nil if @current_demo_session&.id != session[:demo_session]['id'] @current_demo_session ||= Session.find_by(id: session[:demo_session]['id']) if @current_demo_session.nil? session.delete(:demo_session) sign_out end @current_demo_session end end |