<% end %> The final HTML (from the page source) is:
one
1 Why is this? How
Solution 1:
Just change <%= to just <%:
<% shift.ones.timesdo %>
<p>one</p>
<% end %>
This happens because <%= evaluates the expression and prints the returned value, whereas <% just evaluates the expression. And the times method returns the number of times the block was processed (1 time in your example).
Share
Post a Comment
for "Embedded Ruby Html Loops Spit Out Number Of Loop"
Post a Comment for "Embedded Ruby Html Loops Spit Out Number Of Loop"