You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I click the masquerade button on the admin_user_path(:id) (e.g. https://example.com/admin/users/10122496). When I stop masquerading, I'd like to return to that same page.
I thought Devise.masquerade_routes_back = true would do it but that seems to try to take you to that page when you start masquerading, not when stopping
I tried overriding after_back_masquerade_path_for(resource) (code below) but it seems to be too late to grab the masqueraded user. Both resource and current_user refer to (what was) the masquerading_current_user
I hoped maybe I could use *opts with back_masquerade_path(current_user) but I'm not sure where to start
class Admin::MasqueradesController < Devise::MasqueradesController
protected
def after_back_masquerade_path_for(user)
# `user` and `current_user` are both the masquerading user, not the masqueraded user
admin_user_path(user.id)
end
end
Am I missing something obvious?
The text was updated successfully, but these errors were encountered:
I click the masquerade button on the
admin_user_path(:id)
(e.g. https://example.com/admin/users/10122496). When I stop masquerading, I'd like to return to that same page.Devise.masquerade_routes_back = true
would do it but that seems to try to take you to that page when you start masquerading, not when stoppingafter_back_masquerade_path_for(resource)
(code below) but it seems to be too late to grab the masqueraded user. Bothresource
andcurrent_user
refer to (what was) themasquerading_current_user
*opts
withback_masquerade_path(current_user)
but I'm not sure where to startAm I missing something obvious?
The text was updated successfully, but these errors were encountered: