Hi,
I have a fastcsv collection (2d array) that I want to display as a table. I figured the best way would be a helper function, and build the table dynamically.
table = content_tag(:table, #tbody begind content_tag(:tbody, #tr begin collection.collect{|row| content_tag(:tr, #td begin/end row.collect{|field| content_tag(:td, field)}, :class => cycle('list-line-odd', 'list-line-even'))} #tr end ), #tbody end :class => 'grid') #table end
That works really well until I get to the point where I want to add a thead or a tfoot. Is the best way to use a helper for each section rather than doing the entire table?