我有一个来自 rails 应用程序的数组,我得到了以下数组。
[
#<InvoiceDetail id: 66018858, invoice_id: 108855, package_id: 21008265, tracking_num: "1Z1Y81420342195332", base_charge: #<BigDecimal:7fed215e7188,'0.857E1',18(18)>, discount: #<BigDecimal:7fed215e70e8,'-0.308E1',18(18)>, created_at: "2012-07-30 15:33:43", updated_at: "2013-02-27 15:31:16", type_id: 54, transaction_date: "2012-07-23", gl_code: nil, division: nil>,
#<InvoiceDetail id: 66018912, invoice_id: 108855, package_id: 21008282, tracking_num: "1Z1Y81420341336904", base_charge: #<BigDecimal:7fed215e5e78,'0.823E1',18(18)>, discount: #<BigDecimal:7fed215e5d88,'-0.274E1',18(18)>, created_at: "2012-07-30 15:33:44", updated_at: "2013-02-27 15:31:16", type_id: 54, transaction_date: "2012-07-23", gl_code: nil, division: nil>,
#<InvoiceDetail id: 66019132, invoice_id: 108855, package_id: 21008350, tracking_num: "1Z1Y81420340443595", base_charge: #<BigDecimal:7fed215e4988,'0.995E1',18(18)>, discount: #<BigDecimal:7fed215e48e8,'-0.428E1',18(18)>, created_at: "2012-07-30 15:33:46", updated_at: "2013-02-27 15:31:16", type_id: 54, transaction_date: "2012-07-24", gl_code: nil, division: nil>,
#<InvoiceDetail id: 66019370, invoice_id: 108855, package_id: 21008425, tracking_num: "1Z1Y81420341794357", base_charge: #<BigDecimal:7fed215ef608,'0.904E1',18(18)>, discount: #<BigDecimal:7fed215ef568,'-0.355E1',18(18)>, created_at: "2012-07-30 15:33:48", updated_at: "2013-02-27 15:31:16", type_id: 54, transaction_date: "2012-07-26", gl_code: nil, division: nil>,
#<InvoiceDetail id: 66018877, invoice_id: 108855, package_id: 21008271, tracking_num: "1Z1Y81420341786795", base_charge: #<BigDecimal:7fed215ee208,'0.736E1',18(18)>, discount: #<BigDecimal:7fed215ee118,'-0.187E1',18(18)>, created_at: "2012-07-30 15:33:43", updated_at: "2013-02-27 15:31:16", type_id: 54, transaction_date: "2012-07-23", gl_code: nil, division: nil>,
#<InvoiceDetail id: 66018894, invoice_id: 108855, package_id: 21008276, tracking_num: "1Z1Y81420341777849", base_charge: #<BigDecimal:7fed215ecd18,'0.823E1',18(18)>, discount: #<BigDecimal:7fed215ecc78,'-0.274E1',18(18)>, created_at: "2012-07-30 15:33:44", updated_at: "2013-02-27 15:31:16", type_id: 54, transaction_date: "2012-07-23", gl_code: nil, division: nil>
]
我希望将这些数据解析为 html 表。Rails 还是很新的,不知道从哪里开始。
编辑:
这是我希望桌子看起来的样子。
<table class="table table-condensed">
<thead>
<tr>
<th>Invoice Id</th>
<th>Package Id</th>
<th>Tracking Number</th>
<th>Base Charge</th>
<th>Discount</th>
<th>Type Id</th>
<th>Transaction Date</th>
<th>Gl Code</th>
<th>Division</th>
</tr>
</thead>
<tbody>
<tr>
<td>108855</td>
<td>21008265</td>
<td>1Z1Y81420342195332</td>
<td>8</td>
<td>-3</td>
<td>54</td>
<td>2012-07-23</td>
<td>nil</td>
<td>nil</td>
</tr>
</tbody>
</table>