Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Get DOM-friendly IDs from your Rails objects

By Peter Cooper / May 31, 2006

Another new article in Bruce's series shows you how to get DOM-friendly IDs from ActiveRecord. This is a solution nearly all Rails developers have implemented at some time or another:

<% @entries.each do |entry| %>
  <li id='journal-entry-<%= %>'>
    <%= entry.body %>
<% end %>

But Bruce demonstrates a cleaner way..

Other Posts to Enjoy

Twitter Mentions