When I write
module ApplicationHelper def flash_helper flash.each do |key, msg| content_tag :div, msg, :class => key ## "<div class=\"key\">" + msg + "</div>" end end end
I get nothing if not I return . When I call <%= flash_helper %> , the HTML is hiding in my view. What gives? How can I prevent HTML escaping?
return
<%= flash_helper %>
You can use the concat method (Rails> = 2.2.1)
concat
module ApplicationHelper def flash_helper flash.each do |key, msg| concat(content_tag :div, msg, :class => key) end nil end end
can you rewrite it like this?
module ApplicationHelper def flash_helper s = "" flash.each do |key, msg| s += content_tag :div, msg, :class => key ## "<div class=\"key\">" + msg + "</div>" end return s end end
Source: https://habr.com/ru/post/1307876/More articles:Find bounding rectangle of objects in monochrome bitmaps - image-processingEngine App NO CACHE JSP - google-app-enginecalling multiple functions with one instance in scala - scalahtml5 cache → "network: *" does not work - html5Difference between STLPort and SGI STL - c ++PHP sessions that cause Apache to hang indefinitely - windowsAdd 64-bit offset to pointer - pointersArray address and array address [0] - language C - cBest practice for error handling in codeigniter / php applications - functionJava Solutions Anagram - javaAll Articles