Platinum Partner

Creating A Two Dimensional Table With Rails

This code creates a two dimensional table out of data passed from the controller. The code is pretty basic, but there's not much documentation on it.



<% @instance.in_groups_of(5) do |row| %>
 
<% row.each do |data| %>
        # The nil check is required because Rails pads empty table cells with nil.
	
<% end %>
 
<% end %>
<%= data.field unless data.nil? %>
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}