I’m trying to nest content tags into a custom helper, to create something like this:
<ul>
<li>
Microposts
<div>O</div>
</li>
</ul>
I have tried this helper:
def user_info(user)
user_microposts = content_tag(:li, ("Microposts" + " " + content_tag(:div, user.microposts.count.to_s)))
content_tag(:ul, user_microposts)
end
but it renders the div html tags in the view:
Microposts
<div>0</div>
I would be pleased to know how to manage this!
Thank you
You need to mark the string as HTML-safe, like this: