The result of
$self->related_resultset( 'user_role' )
is a App::DB::ResultSet
Since it’s declared as ‘has_many’ you have to either wrap it in a
loop to extract the individual APP::DB::Result::UserRole so you can call
->my_method
(or use ->single)
On 15 Jul 2015, at 15:08, Bill Moseley wrote:
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
mose...@hank.org
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive:
http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk