Class: SwitchUserController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/switch_user_controller.rb

Instance Method Summary collapse

Instance Method Details

#remember_userObject



17
18
19
20
21
22
23
24
# File 'app/controllers/switch_user_controller.rb', line 17

def remember_user
  redirect_path = SwitchUser.redirect_path.call(request, params)
  if Rails.version.to_i >= 5 && redirect_path == :back
    redirect_back(fallback_location: root_path)
  else
    redirect_to(redirect_path)
  end
end

#set_current_userObject



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/switch_user_controller.rb', line 6

def set_current_user
  handle_request(params)

  redirect_path = SwitchUser.redirect_path.call(request, params)
  if Rails.version.to_i >= 5 && redirect_path == :back
    redirect_back(fallback_location: root_path)
  else
    redirect_to(redirect_path)
  end
end