[CDBI] A many to many relationship question (getting error)

Peter Speltz peterspeltz at gmail.com
Thu Oct 5 17:22:08 BST 2006


> ERROR:
> usersinfo is not a column of RemindMe::Data::UsersGroups at
> /usr/local/share/perl/5.8.7/Class/DBI/Relationship/HasMany.pm line 112
>

Has many uses the has_a column  to determine the FK  and if there is
no has_a  then it assumes the class moniker which is "userinfo" .  Put
user_groups definition before the others since it defines the has_a 's
.   Alternatively, and what i mostly do to prevent this error  ,
specify the FK name as a 3rd arg to has_many  ie :

__PACKAGE__->has_many( users => [ 'UsersGroups' => 'uid' ] , 'gid');

See docs for more details.



More information about the ClassDBI mailing list