$related->{$key} = $rel_obj;
next;
}
- elsif ($acc_type eq 'multi' && ref $attrs->{$key} eq 'ARRAY' ) {
+ elsif ($acc_type eq 'multi') {
my $others = delete $attrs->{$key};
+ $others = [ $others ] unless ref $others eq 'ARRAY';
my $total = @$others;
my @objects;
foreach my $idx (0 .. $#$others) {
])
}, 'empty has_many relationship accepted by populate');
+lives_ok ( sub {
+ $schema->populate('Artist', [
+ { name => 'Snuggy Bottoms',
+ cds => { title => 'Hit My Singlet', year => 1973,
+ tracks => { title => 'Grunt', position => 0 },
+ },
+ },
+ ])
+}, 'single hashref accepted by populate on has_many');
+
done_testing;