Friday, August 05, 2016

rails content_tag_for

Do not use the rails content_tag_for. Just use html with embedded Ruby. Read the Beautiful Markup RailsConf 2010 presentation for more details. It has been removed from rails and is now available as record_tag_helper gem.

<%= content_tag_for(:tr, @article) do %>
  <td><%= @article.title %></td>
<% end %> 


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

No comments:

Post a Comment