html_table
Table creates horizontal html tables. Table is very small and very DRY to use. Their is no repetition between header definition and attribute definition. Actually their is no thead definition.
Example
table(products) do |row|
row.column :name
row.column :description
row.column :price
end
this generates (formatted for reading purposes)
<table>
<thead>
<th>name</th>
<th>description</th>
<th>price</th>
</thead>
<tbody>
<tr>
<td>Tomato</td>
<td>Delicious red fruit.</td>
<td>€14/kg</td>
</tr>
</tbody>
</table>
Installation
gem install html_table
Configuration
You could also specify a class attribute for the table using
table(collection, :class => "some_class")
If you're using it together with Rails you could try
table-rails -> still working on it
To use different column headers one should overwrite
class HtmlTable::TableBuilder
def column_translation column
I18n.t(column)
end
end
Copyright (c) 2011 Tom Maeckelberghe, released under the MIT license