Skip to content

Instantly share code, notes, and snippets.

@EtienneDepaulis
Created August 28, 2012 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EtienneDepaulis/3498147 to your computer and use it in GitHub Desktop.
Save EtienneDepaulis/3498147 to your computer and use it in GitHub Desktop.
Active Admin : Switching to another user
# 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