The Devise sign-in flash message is displayed correctly after redirecting to the stored location for a user. I’ve overridden session#destroy so that it also redirects to the stored location (rather than root), but the corresponding flash message is lost, and I cannot see why. These are the relevant bits from my SessionsController:
class Users::SessionsController < Devise::SessionsController
def destroy
# The commented out lines make no difference
# set_flash_message :notice, :signed_out
# flash.keep(:notice)
sign_out_and_redirect(current_user)
end
protected
def after_sign_out_path_for(resource_or_scope)
stored_location_for(resource_or_scope)
end
Before you ask: no, the stored location does not perform any additional redirects. I’ve looked through the Devise documentation, and their Github issues, as well as StackOverflow and the web in general, but no one else seems to have this issue. Weird.