I am trying to return a formatted error message in the ActiveControler flash hash. This is rendered in my layout as:
<% flash.each do |name, msg| %>
#<%= content_tag :p, msg, class: "flash #{name}" %>
<% end %>
When the msg = 'Bob' I get:
<p class="flash error">Bob</p>
Which displays as:
Bob
When the msg = '
- Bob
<p class="flash error">"<ol><li>Bob</li></ol>"</p>
Which displays as:
<ol><li>Bob</li></ol>
What I want is to have it displayed as an ordered list of error messages.
I have also tried changing out the content_tag helper for straight hand coded markup and that doesn't change anything. I also tried replacing "<" and ">" with < and >. Of course that didn't help either. I know I can give up on this and write a custom error reporting page that behaves exactly as I want, but I was trying to do this in a simpler way.
<ol> <% flash.each do |name, msg| %> <%= content_tag :li, msg.html_safe, class: "flash #{name}" %> <% end %></ol>