Comments in ERB end tags

· 0 minute read

When writing ERB templates you inevitably end up with a stack of <% end %> tags. Even with indentation it is often hard impossible to know which opening tag they belong to.

They are regular ERB tags though, so you can add comments:

        <% end  # link_to %>
      <% end  # ItemCard %>
    <% end  # items each %>
  <% end  # Card footer %>
<% end  # Card %>