I want to display a new flash msg on logout under a particular condition.. I'm overriding the after_sign_out_path_for
method in application_controller.rb
. I have added a new msg in devise.en.yml
too. How do I flash the new msg on logout when its redirected to sign in page???
application_controller.rb:
def after_sign_out_path_for(resource_or_scope)
if is_already_logged_in?
flash.keep[:notice] = t("devise.failure.concurrent")// IS NOT WORKING
new_user_session_path
else
new_user_session_path(resource)
end
end
devise.en.yml:
en:
devise:
confirmations:
confirmed: "Your account was successfully confirmed. You are now signed in."
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
failure:
already_authenticated: "You are already signed in."
inactive: "Your account was not activated yet."
invalid: "Invalid email or password."
invalid_token: "Invalid authentication token."
locked: "Your account is locked."
not_found_in_database: "Invalid email or password."
timeout: "Your session expired, please sign in again to continue."
unauthenticated: "You need to sign in or sign up before continuing."
unconfirmed: "You have to confirm your account before continuing."
// NEW MESSAGE ADDED
concurrent: "You are signed out due to concurrent sessions!"
mailer:
confirmation_instructions:
subject: "Confirmation instructions"