GOD mode with Active admin gem.
Implementing GOD mode in Active Admin
####Number of clients asked me if it is possible to add GOD mode in application, where admin user will be able to login as any of other user and perform the operations as that user.
- Your app is a Rails application.
- Your application is using Devise for authentication.
- Active Admin implementation.
Let’s do some code:
- I am assuming you are having one model named User.
- First open up file myawesomeproject/admin/user.rb and add the following code there.
- Add path in config/routes.rb
You might have noticed I am pointing it to a normal URL outside the active admin actions, the reason is I want to use sign_in method that devise provides, it is available in the Devise::SessionsController.
Now override the sessions controller by inheriting from Devise::SessionsController and put this code inside.
Happy Coding :)Written on April 25, 2015
Share in your circles :)