add documentation for switch_back feature
lcowell opened this issue · 10 comments
How to enable and disable the feature as well as describing how to construct a guard safely needs to be documented.
edit: marking for 0.9.3. I'd prefer to soft-launch the feature to give me a change to make any adjustments.
Hi, we'd really appreciate some docs on this if you can. It's a great plugin, but we really need to be able to switch back for it to be perfect.
Hi @nikonlenswear I'm hoping to write something up this weekend. I won't make a release for this, but you'll be able to find the updated information on the github page. I'll update this thread once I've added something.
hey lcowell,
thx for the gem! I wrote this https://github.com/jackdempsey/spy some years ago and never really had the time to make it smooth. I'm liking switch_user so far and will be using it instead. I was a bit surprised to not find a switch back ability though, so just wanted to add a +1 for it :-) I'm happy to test it out this week if you need some other eyes helping find bugs.
cheers,
j
I've added some documentation to the README for the switch_back feature. You can view it here: https://github.com/flyerhzm/switch_user/blob/master/README.md
Awesome, trying it out tonight. Thanks!
On Mon, May 20, 2013 at 11:08 AM, Luke Cowell notifications@github.comwrote:
I've added some documentation to the README for the switch_back feature.
You can view it here:
https://github.com/flyerhzm/switch_user/blob/master/README.md—
Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-18162805
.
Is that all that's needed? I tried it and got an error on the config.switch_user=true bit, and then when I removed that from the config, I see "wrong number of arguments (2 for 3)" for the switch_user_select call. Feels as though I'm doing something boneheaded.
Hi, I'm trying it too, and I also had that error.
I think the docs have a typo and it's actually
config.switch_back = true
This reveals the checkbox, but I also see the 'wrong number of arguments' error.
On 21/05/2013, at 4:32 PM, jack dempsey wrote:
Is that all that's needed? I tried it and got an error on the config.switch_user=true bit, and then when I removed that from the config, I see "wrong number of arguments (2 for 3)" for the switch_user_select call. Feels as though I'm doing something boneheaded.
—
Reply to this email directly or view it on GitHub.
Hi @nikonlenswear, can you provide a stack trace ? Sorry I didn't get back to you sooner, I wasn't notified that you'd commented.
Believe the issue is comes from line 43 of:
https://github.com/flyerhzm/switch_user/blob/master/app/helpers/switch_user_helper.rb
When using the following as your view_guard:
config.view_guard = lambda { |current_user, request, original_user|
current_user && current_user.admin? || original_user && original_user.admin?
}
Horrible hack, but had to fix this tonight so went for this in my switch_user initializer:
SwitchUserHelper.module_eval do
def available?
user = provider.current_users_without_scope.first
SwitchUser.view_guard(user, request, provider.original_user)
end
end