[Dbix-class] Accessing related table via method of the table's name

Sixtease sixtease+dbix at gmail.com
Sun Jun 28 18:16:05 GMT 2009


Hello all,

I'm new to the list and fairly new to DBIx::Class as well.

I have built an application on Catalyst with PostgreSQL. I have a
table for contests and a table for rounds. Each round has its contest.
I've been using this way to access a round's contest:

$round = $c->model->resultset('Rounds')->find( $id );
$contest = $round->contest;

But then I had to upgrade from the DBIx::Class version I had from the
debian Catalyst package to latest and this no longer works. Now I have
to do like

$contest_id = $round->get_column('contest');
$contest = $c->model->resultset('Contests')->find( $contest_id );

which is clumsy at best. Is there a way to restore the original
functionality? I suppose it could have something to do with the fact
I'm using a dynamic DB model.

Thanks
~ Sixtease



More information about the DBIx-Class mailing list