Re: [Dbix-class] has_one over joining table

2018-01-30 Thread Andrew Beverley
On Tue, 30 Jan 2018 09:42:26 +0100 Stuart Dodds wrote: > > You would then do something like: > > > > $town->town_people_mayor->mayor > > Hi Andy, > > Yes, that works perfectly...thank you! You're welcome! > It would have been nice to do it in one step as I wouldn't need to > change the

Re: [Dbix-class] has_one over joining table

2018-01-30 Thread Stuart Dodds
On 29/01/18 17:31, Andrew Beverley wrote: > Something like (in Result::Town): > > __PACKAGE__->might_have( > "town_people_mayor", > "MyApp::Schema::Result::TownPeople", > sub { > my $args = shift; > return { > "$args->{foreign_alias}.town_id" => { -ident