ankane / pretender

Log in as another user in Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

current_user helper

dclausen opened this issue · comments

When using pretender and devise, I noticed that the controller method for current_user is being updated to the impersonated user. However, when calling current_user within a view via <%= current_user %>, I see the true user instead. As a workaround, I updated the view to use <%= controller.current_user %>. Is this expected?

Hey @dclausen, I think it may be something specific to your application, as I'm not able to reproduce with a fresh Rails app.

You can try adding helper_method :current_user after impersonates :user to fix it.

Closing due to no response