[Dbix-class] $self->related_resultset( 'user_role' ) returning App::DB::ResultSet

Bill Moseley moseley at hank.org
Wed Jul 15 22:08:44 GMT 2015


Interesting problem today.  Running 0.082800.

I don't have much to go on here, but maybe someone has seen this before.

This line of code in my "User" Result class was throwing an exception.
It's in a Moose builder:

return $self->related_resultset( 'user_role' )->my_method->count > 0;


saying:

Can't locate object method "my_method" via package "App::DB::ResultSet"

That method "my_method" is not in App::DB::ResultSet.  It is in
App::DB::ResultSet::UserRole.
I'm expecting that related_resultset( 'user_role' ) would return
App::DB::ResultSet::UserRole.

And, well, it does when run outside of mod_perl.  And now, after quite a
few Apache restarts and adding some debugging code, it is now returning
App::DB::ResultSet::UserRole.

Has anyone had a case where related_resultset() returns a ResultSet object?


FWIW, the relationship is defined as so in Result::User:

__PACKAGE__->has_many(
    'user_role',
    'App::DB::Result::UserRole',
    { 'foreign.user_id' => 'self.id' },
);



-- 
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20150715/ef4e7dce/attachment.htm>


More information about the DBIx-Class mailing list