Thursday, August 04, 2016

rails div_for

This:

<%= div_for(@article, class: "frontpage") do %>
  <td><%= @article.title %></td>
<% end %>

Becomes:

<div id="article_1234" class="article frontpage">
  <td>Hello World!</td>
</div>

This has been deprecated. It is also not a good practice to use the div_for tag. Why? Checkout the: Beautiful Markup Rails Conf Presentation slides. If you really need it, it is now part of the record_tag_helper gem.

No comments:

Post a Comment