Subject: | Maypole::Model::CDBI::related_class() is broken |
David Baird reported this a while ago, but it's still broken ....
Maypole::Model::CDBI::related returns a list, not a hashref. This patch seems to do the right thing, but this is at the limit of my CDBI-fu so treat with caution.
Cheers,
d.
--- /usr/lib/perl5/site_perl/5.6.1/Maypole/Model/CDBI.pm Fri Oct 15 23:01:22 2004
+++ Maypole-Model-CDBI/lib/Maypole/Model/CDBI.pm Tue Dec 7 14:08:18 2004
@@ -80,8 +80,13 @@
sub related_class {
my ( $self, $r, $accessor ) = @_;
- my $related = $self->related->{$accessor};
- if ( my $mapping = $related->{args}->{mapping} ) {
+
+ my $related = $self->meta_info( has_many => $accessor ) ||
+ $self->meta_info( has_a => $accessor ) ||
+ return;
+
+ my $mapping = $related->{args}->{mapping};
+ if ( @$mapping ) {
return $related->{foreign_class}->meta_info('has_a')->{ $$mapping[0] }
->{foreign_class};
}