How to do a simple HAML loop. That would be like this in ERB view:
<table>
<tr>
<th></th>
<th></th>
</tr>
<%= @price. each do |row| %>
<tr>
<td><%= row.year %></td>
</tr>
<% end %>
</table>
Example just tried this:
%table
%tbody
%tr
%th year
%th price
Error:
Inconsistent indentation: 3 spaces were used for indentation
In HAML the indentation matters, and it means the code nesting, which allows you not to use closing tags and
endstatements in Ruby code. To make HAML understand your nesting properly, all the indents need to be the same size, 2 spaces for example.So, your ERB code will look the following: