Is there a way to add a class or an id to a specific flash message? I need to have some messages fade away and some persist. I would like to do this based on a html class.
Thanks for any help
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is nothing magical about what can put in the flash. It’s just a hash that is stuffed in the session and cleared out for you.
You could (for example) do
And then in your layout
But there’s definitely more than one way to do this – you could just use one class when it’s
flash[:notice], another forflash[:error]etc