I would like to customize the following flash msg provided by devise in the devise.en.yml file:
devise:
failure:
unconfirmed: 'You have to confirm your account before continuing.'
with ruby code in order to get a link to new_user_confirmation_path.
in other words, I want my flash message displays something like :
'You have to confirm your account before continuing. Didn't receive confirmation instructions?'
where 'Didn't receive confirmation instructions?' is a link to new_user_confirmation_path.
I would like to know if I can do this without editing the user controller cause Devise doesn't provide it by default.
Thanks for your answer!
new_user_confirmation_path
is a static url equivalent to /users/confirmation/new
So you can just do this in your devise.en.yml file:
devise:
failure:
unconfirmed: "You have to confirm your account before continuing. <a href='/users/confirmation/new'>Didn't receive confirmation instructions?</a>"
In the controller actions where you display your flash make sure you have .html_safe
e.g. flash[:error].html_safe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With