Created
August 28, 2012 13:49
-
-
Save EtienneDepaulis/3498147 to your computer and use it in GitHub Desktop.
Active Admin : Switching to another user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# admin/users.rb | |
index do | |
column("") { |user| link_to "Switch", switch_to_admin_user_path(user), method: :post, target: "_blank"} | |
end | |
member_action :switch_to, method: :post do | |
user = User.find(params[:id]) | |
sign_out :user if user_signed_in? | |
sign_in :user, user | |
redirect_to root_path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment