You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KevinTriplett edited this page Jun 13, 2012
·
1 revision
If your application requires that signed in users access your site using HTTPS protocol, but you need them to be redirected back to HTTP protocol when they sign out, put this in your application_controller.rb file:
def after_sign_out_path_for(resource_or_scope)
root_url(:protocol => 'http')
end
If you want them to be re-directed back to some other address, use that instead of root, but you must use the *_url suffix because the *_path helpers ignore the :protocol key.
However, if you have multiple roles, like an admin and client and supervisor, it's a little more complicated, not much:
When this method is called, current_{resource_name} for the role from which the user has just signed out is non-nil. So you have to check for only 1 role still non-nil, then you know that they are signing out from their last role. You see, Devise is so awesome that a user can be signed in under more than one role!