From: Daniel Ruoso Date: Wed, 24 Nov 2010 19:08:07 +0000 (-0300) Subject: refuse to invoke create_related as class method X-Git-Tag: v0.08190~1^2~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8d656b21a2745da7ce24bf7fca2e3b28fe37ec58;p=dbsrgits%2FDBIx-Class.git refuse to invoke create_related as class method t/cdbi/09-has-many.t has a specific test for it. --- diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 49a0ebe..2fba9bb 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -570,6 +570,9 @@ sub create_related { my $self = shift; my $rel = shift; + $self->throw_exception("Can't call *_related as class methods") + unless ref $self; + # we need to stop and check if this is at all possible. If this is # an extended relationship with an incomplete definition, we should # just forbid it right now.