flyerhzm / switch_user

Easily switch current user
MIT License
730 stars 108 forks source link

Conditional redirect_path Based on Current User. #136

Open Austin-dv-Evans opened 3 years ago

Austin-dv-Evans commented 3 years ago

Hello, I am wondering if it is possible to conditionally return one of two redirections based on the current user type. It appears that I cant pass a current_user third argument to the config.redirect_path. Is there any way I can access current_user from within this configuration?

I am hoping to do something like this.

config.redirect_path = lambda { |request, params, current_user| current_user.user_type_x ? '/path_one' : '/path_two' }

flyerhzm commented 3 years ago

@Austin-dv-Evans it doesn't support yet, but any PR is welcome