HTML line break within flash error?
I have a flash[:error] with an html line break. When it gets displayed, it literally show <br />
instead of interpreting it as html and breaking. Heres my error:
flash[:error] = "Format of search criteria is wrong.<br />Should be [
IXLSpecClass value开发者_高级运维][year]-[Message ID] for example GP07-8"
Yup. Since strings in Rails 3 (you're in Rails 3, right?) are escaped by default, you'd need to go into your template and instead of flash[:error]
you would need to print flash[:error].html_safe
in order to have it avoid automatic escaping.
That is because if you view the source it probably looks like this:
<br /> or to put it simply: <br />
This is because the html was probably escaped at some point down the line.
精彩评论