Short version:

$userexam->user is defined as Auth::User, but seems like it gets redefined
as DB::User somewhere mysteriously.

How can I track that down?

Long version:

Split database setup: DB is for the application data, Auth is for user data.

The userexam table links users to the exams they take.

__PACKAGE__->belongs_to( user => 'Learn::Schema::Auth::Result::User' );
__PACKAGE__->belongs_to( exam => 'Learn::Schema::DB::Result::Exam' );

*Schema/DB/ResultSet/* contains:

sub take { # take the exam
    my $rs      = shift; # Learn::Schema::DB::ResultSet::UserExam object
    my $user    = shift; # Learn::Model::Auth::User object
    my $exam    = shift; # Learn::Model::DB::Exam object
    my $user_exam = $rs->create({
        user => $user,
        exam => $exam,

The error it throws at $rs->create() is:

Objects supplied as 'foreign_values'
usually should inherit from the related ResultClass
perhaps you've made a mistake invoking the condition resolver?

In the schema file ->user is defined as Auth::User. Somehow it gets
redefined along the way and Catalyst things it should be DB::User instead?!

Grepping for DB.*User (and variations) in schema files brings up
DB::UserExams and related info (DB::UserCourse, DB::UserRole,
DB::UserAnswer) but no DB::User at all.

How could that get redefined? Or is this a symptom of something else? I
could use a big clue stick upside the head :/


"Ask for nothing, and you will receive nothing." -- the folks at Global

“The cure to boredom is curiosity. There is no cure for curiosity.”

Dorothy Parker

Searchable archive:
Dev site:

Reply via email to