假设我有一个 ActiveRecord 查询:
User.select('name', 'created_at').all
=> [#<User created_at: "2012-08-06 13:27:40", name: "Alice">, #<User created_at: "2012-08-06 15:41:33", name: "Bill">]
如何按created_at
列显示具有行跨度的可排序表?
预期的输出html:
<table>
<tr>
<th>created_at</th>
<td>name</td>
</tr>
<tr>
<td>2012-08-06</td>
<td>Alice</td>
</tr>
<tr>
<td>2012-08-06</td>
<td>Bill</td>
</tr>
</table>