Nesting of li>ul>li types for content_for

  question, ruby

In Rails helper, I built a method like this:

def ul_li_ul_nest
 fruit = %w(apple watermelon orange pear pineapple)
 info = %w(price place weight)
 content_tag(:ul) do
 fruit.collect do |i|
 content_tag(:li) do
 i
 content_tag :ul do
 info.collect do |ii|
 content_tag :li do
 ii
 end
 end.join('').html_safe
 end
 end
 end.join('').html_safe
 end
 end

The result of its output is:

<ul>
 <li>
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 <li>
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 <li>
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 <li>
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 <li>
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 </ul>

And my expected output is:

<ul>
 <li>
 apple
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 <li>
 watermelon
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 <li>
 orange
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 <li>
 pear
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 <li>
 pineapple
 <ul>
 <li>price</li>
 <li>place</li>
 <li>weight</li>
 </ul>
 </li>
 </ul>

How to modify to achieve this result?

def ul_li_ul_nest
 fruit = %w(apple watermelon orange pear pineapple)
 info = %w(price place weight)
 content_tag(:ul) do
 fruit.collect do |i|
 content_tag(:li) do
 i.html_safe + content_tag(:ul) do
 info.collect do |ii|
 content_tag :li do
 ii
 end
 end.join('').html_safe
 end
 end
 end.join('').html_safe
 end
 end