Notes posted by sagarbommidi
RSS feed
sagarbommidi -
April 2, 2013 - (v3.0.0 - v3.2.13)
0 thanks
Use concat insted of joining collection explicitely
concat method will be useful to join the collection object from looping conditions.
arr = ["a", "b", "c"] content_tag(:ul, :class => 'a class') do arr.each do |item| concat content_tag(:li, item) end
And this will generate the html as shown below
<ul class="a class"> <li>a</li> <li>b</li> <li>c</li> </ul>