Creating A Two Dimensional Table With Rails
Join the DZone community and get the full member experience.Join For Free
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 %> <%= data.field unless data.nil? %><% end %>
Opinions expressed by DZone contributors are their own.