http://www.perlmonks.org?node_id=1178740


in reply to DBI::Class relationship naming

Is this exactly the code you are running? If so, you probably are missing a 's'

my $t1_rs = $schema->resultset('T1'); $query_rs = $t1_rs->search; while (my $account = $query_rs->next) { print Dumper $account->groupname->name; } # here ---^

since in your table t1 the column is named "groupnames", not "groupname".

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: DBI::Class relationship naming
by Beatnik (Parson) on Jan 01, 2017 at 08:06 UTC
    Actually, that was exactly my point. The code is running fine despite the fact that the field is not called the same. The relationship mapping is renaming the field/method.


    Greetz
    Beatnik
    ... I'm belgian but I don't play one on TV.
      Can you replicate the problem, if you use names that are more dissimilar, e.g. foogroup and bargroup? Perhaps there is some strncmp involved somewhere (or some other "groupname" …)