flyerhzm/switch_user — pull request #14 by xtreme-tanzeeb-khalili (2012-03-26 23:04:27+00:00)
Title: Passing controller to guard instead of current_user and request

Hi Richard,

How do you feel about changing the parameter definitions for the controller and view guards? I ran into a problem that I could not solve otherwise.

My project has two sets of devise users, ```AdminUsers``` and ```Users```, and a single visitor can be signed in as both simultaneously. In order to give only ```AdminUsers``` the ability to switch to different ```Users```, I needed to check the ```current_admin_user``` in my guard.

The only solution I could think of was to modify the guards to take the ```controller```, then check for ```controller.current_admin_user```.