On Wed, Apr 24, 2013 at 11:38 PM, Mark Gibson <
gibbom...@gmail.com> wrote:
> def line_item_rows
> [["Description", "Items" ,"Price ex GST"]] +
> @line_items.map do |item|
> [item.description, "", price(item.charge_ex_gst)] +
> item.sub_items.map do |sub_item|
> [ "","#{sub_item.quantity} x #{
sub_item.name}",
> price(sub_item.total_charge_ex_gst)]
> end
> end +
> [["","Grand Total", price(@project.charge_ex_gst)]]
> end
>
> When I run this page I get the "data must be a two dimensional array of
> cellable objects" error
Are you trying to render one row for each sub-item, or are you trying
to show each sub-item in a new column in the same row as the item?
Currently, each iteration of the outer @line_items.map block comprises
one row of the table. If you're trying to create multiple rows via
that iteration, your best bet may be to try to convert that to an each
and build up the array manually:
rows = [["Description", "Items", "Price ex GST"]]
@line_items.each do |item|
rows << [... item information ...]
item.sub_items.each do |sub_item|
rows << [... subitem information ...]
end
end
Hope this helps!
-be