flyerhzm/switch_user

Remember "original_user" for switch_back does not respect SwitchUser.available_users_identifiers

jigyasam opened this issue · 1 comments

Hi

Thanks for the gem, it works really well for my Rails - devise setup. However I'm facing this issue where I have the user identifier other than ID:

config.available_users_identifiers = { :user => :slug }

When I check the checkbox next to switch_user_select before switching from "admin" to a "user" for switching back, the value stored in the session[:original_user_scope_identifier] is still "user_ID" instead of "user_SLUG". Consequently, I cannot "switch back" as the saved admin user cannot be found with the query:

User.where(slug: ID_stored_in_session) 

If I find some time, I'd try to submit a pull request with a fix. Reporting it until then :)

Bump, I am seeing this too.