ruby on rails - Dissecting an ERB to HAML conversion example -
directly rom haml tutorial:
<div class='item' id='item<%= item.id %>'> <%= item.body %> </div>
and answer
.item{:id => "item#{item.id}"}= item.body
i understood reason first .item
, ok class declare way. understood hash, ok when have attributes create hash it. part couldn't understand how converted "item#{item.id}"
shouldn't sort of "="
sign somewhere? because saying when want calculate ruby code use "="
?
{:id => "item#{item.id}"}
evaluated hash in ruby code haml, don't need =
Comments
Post a Comment