Subject: | display of has_many columns is broken in new tabulate |
I inserted the following for debugging at line 168 in _tabulate:
use Data::Dumper;
print STDERR Dumper($cols);
my @blah = map { $object->$_ } @$cols;
print STDERR Dumper(@blah);
It produces the following results:
$VAR1 = [
'table_id',
'ref',
'description',
'num_items',
'm_time',
'items'
];
$VAR1 = [
'table_id',
'ref',
'description',
'num_items',
'm_time',
'items'
];
$VAR1 = '3';
$VAR2 = 'blibble';
$VAR3 = 'blabble';
$VAR4 = '0';
$VAR5 = bless( [
27,
5,
17,
18,
6,
105,
1,
198,
0,
undef,
0,
0
], 'Time::Piece' );
In other words, the items field vanishes entirely, presumably because $object->$_ is returning undef or an empty array. In my database as it currently stands there are not yet any items. Presumably if there were, _tabulate() would work ok. But in the case where there are none, it produces a big problem because an entire column is missing from the resulting HTML table, causing misalignment. This is, perhaps, yet another argument for forced stringification (see #13778).
BTW, I'm not so sure if it's a good idea to include _all_ related items in a case like this (there could be dozens or even hundreds or thousands), although I certainly appreciate the added functionality and speed with which the general issue (tabulate always assuming display_columns) was resolved.