[CDBI] A many to many relationship question (getting error)
gecon at di.uoa.gr
Thu Oct 5 19:52:24 BST 2006
Peter Speltz wrote:
>> 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.
I'm using different files for each of my classes and all of them have a
use base 'BaseDB';
before any other "use" statements (BaseDB is_a Class::DBI).
I guess it should be working this way, but anyway...
> 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.
Did that, everything is working fine now. Thank you.
More information about the ClassDBI