当我在 erb- 模板文件中使用 if 语句时,if 语句被延迟评估,这混淆了 html:
<small>
<% if @applause_count == 1 %>
The author has been cheered up once!
<% elsif @applause_count > 1%>
The author has been cheered up <%= @applause_count %> times! <br/>Be the next!
<% end if %>
</small>
产生:
<small>
</small>
The author has been cheered up 100 times! <br/>Be the next!
有人可以向我解释这种奇怪的行为吗?