Reputation: 3264
I am using devise for authentication purpose and all functionalities are working fine.
When a user signs out, The flash message which displaying is "Signed out successfully."
.This can be customized in devise.en.yml.
But I need this to be dynamic (like) "user.email
signed out successfully". How to make devise flash messages to be dynamic?
Upvotes: 0
Views: 1484
Reputation: 3264
I managed to display this thing.
To do this we want to create a 'devise' folder in controllers and create a new controller 'sessions', and do the rest of things.
I have given my code:
def create
resource = warden.authenticate!(:scope => resource_name, :recall => "new")
session["resource_email"] = resource.email
flash[:notice] = "#{resource.email} signed in successfully.."
sign_in_and_redirect(resource_name, resource)
end
def destroy
flash[:notice] = "#{session["resource_email"]} signed out successfully.."
sign_out_and_redirect(resource_name)
end
Upvotes: 1