[Dbix-class] bug in CascadeActions->update for might_have that doesn't have one
Mark Hedges
hedges at ucsd.edu
Sat Apr 8 01:18:23 CEST 2006
Kept getting this error trying to update an object:
Can't call method "update" on an undefined value at
/usr/local/share/perl/5.8.8/DBIx/Class/Relationship/CascadeActions.pm
line 36.
In this case the relationship is defined as 'might_have' and for
this object, it doesn't have one.
This solves the problem:
--- /tmp/CascadeActions.pm 2006-04-07 16:15:25.000000000 -0700
+++ /usr/local/share/perl/5.8.8/DBIx/Class/Relationship/CascadeActions.pm 2006-04-07 16:15:30.000000000 -0700
@@ -33,7 +33,7 @@
my %rels = map { $_ => $source->relationship_info($_) } $source->relationships;
my @cascade = grep { $rels{$_}{attrs}{cascade_update} } keys %rels;
foreach my $rel (@cascade) {
- $_->update for grep {$_} $self->$rel;
+ $_->update for $self->$rel;
}
return $ret;
}
Sorry if I got that backwards, I can never seem to remember.
--- /tmp/CascadeActions.pm 2006-04-07 16:12:06.000000000 -0700
+++ /usr/local/share/perl/5.8.8/DBIx/Class/Relationship/CascadeActions.pm 2006-04-07 16:15:02.000000000 -0700
@@ -33,7 +33,7 @@
my %rels = map { $_ => $source->relationship_info($_) } $source->relationships;
my @cascade = grep { $rels{$_}{attrs}{cascade_update} } keys %rels;
foreach my $rel (@cascade) {
- $_->update for $self->$rel;
+ $_->update for grep {$_} $self->$rel;
}
return $ret;
}
Mark
More information about the Dbix-class
mailing list