title: content_tag behavior different in view and helper
body: <p>Someone can explain me why content_tag have a different behavior in view and helpers? A simple code like the one below returns (1) when in the view, but (2) when in the Helper.</p>
  
  <pre><code>  arr = ["a", "b", "c"]
    concat content_tag(:ul, :class =&gt; 'a class') do
      arr.each do |item|
        concat content_tag(:li, item)
      end
    end
  </code></pre>
  
  <p>(1)</p>
  
  <pre><code>&lt;ul class="a class"&gt;
    &lt;li&gt;a&lt;/li&gt;
    &lt;li&gt;b&lt;/li&gt;
    &lt;li&gt;c&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>(2)</p>
  
  <pre><code>&lt;ul&gt;{:class=&amp;gt;"a class"}&lt;/ul&gt;
  </code></pre>
  
  <p>When using <code>content_tag(:ul, '', :class => 'a class')</code> in the Helper, it renders <code>&lt;ul class="a class"&gt;&lt;/ul&gt;</code>. Why this different behavior too?</p>
  
  <p>The content_tag's behavior is very confusing. I tried some magic with the capture (another confusing method!) method, but without any success.</p>
  
  <p>So... any ideas?</p>
  
  <p>PS.: I'm using rails 4</p>
  
  <p>-------------edit--------------</p>
  
  <p>Since my example is really bad, what I'm really trying to do is somethind like that:</p>
  
  <pre><code>  def language_dropdown
      content_tag :li, class: "dropdown language" do
        concat content_tag(:a, content_tag(:span, I18n.locale, class: "username"),
                       class: "dropdown-toggle", data: { toggle: "dropdown", hover: "dropdown", "close-others" =&gt; "true" } )
  
        concat( content_tag(:ul, class: "dropdown-menu") do
          I18n.available_locales.each do |locale|
            if locale != I18n.locale
              locale_key = "translation.#{locale}"
              content_tag :li do
                concat(link_to I18n.t(locale_key), url_for(locale: locale.to_s))
              end
            end
          end
        end)
      end.html_safe
    end
  </code></pre>