You can simply supply a hashref with the join expression to has_many
and belongs_to
. In MyApp::Schema::Result::GameUser
:
__PACKAGE__->has_many(turns => 'MyApp::Schema::Result::Turn', {
'foreign.game_id' => 'self.game_id',
'foreign.user_id' => 'self.user_id',
});
In MyApp::Schema::Result::Turn
:
__PACKAGE__->belongs_to(game_user => 'MyApp::Schema::Result::GameUser', {
'foreign.game_id' => 'self.game_id',
'foreign.user_id' => 'self.user_id',
});