0
我有嵌套阵列ERB模板:嵌套阵列
book= {"Dan Brown"=>["Angels and Demons", "The Da Vinci Code"], "Dale Carnegie"=>["How to Win Friends and Influence People", "How to Stop Worrying and Start Living"]}
我需要这个HTML结果:
<h3 class="title">Book</h3>
<h4>Dan Brown</h4>
<ul>
<li>Angels and Demons</li>
<li>The Da Vinci Code</li>
</ul>
<h4>Dale Carnegie</h4>
<ul>
<li>How to Win Friends and Influence People</li>
<li>How to Stop Worrying and Start Living</li>
</ul>
无法理解如何通过ERB模板做到这一点。
,可自本方法:
book.each {|key, value| puts "#{key} is #{value}" }
但对我来说这种方法不工作,我想我不明白如何使用它。 谢谢你的帮助。
谢谢您是工作:-) –