[Catalyst] has_many and belongs_to with InstantCRUD
Kevin Old
kevinold at gmail.com
Wed Jun 14 04:47:45 CEST 2006
Hello everyone,
I'm trying to get InstantCRUD to work with 2 tables and can't seem to
figure out what "path" I'm suppose to provide to the table modules.
Here's what I have, any help is appreciated:
package DBSchema::Messages;
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components(qw/PK::Auto::Pg Core/);
__PACKAGE__->table('messages');
__PACKAGE__->add_columns(qw/id msg c_time email_to email_from/);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->belongs_to(user => 'instantcrud::DBSchema::Users');
package DBSchema::Users;
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components(qw/PK::Auto::Pg Core/);
__PACKAGE__->table('users');
__PACKAGE__->add_columns(qw/id username password/);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->has_many(messages => 'instantcrud::DBSchema::Messages');
Couldn't instantiate component "instantcrud::Model::DBICSchemamodel",
"Cannot load schema class 'DBSchema':
DBIx::Class::Relationship::BelongsTo::belongs_to(): Can't infer join
condition for user on DBSchema::Messages; unable to load
instantcrud::DBSchema::Users at
/home/kevin/projects/instantcrud/script/../lib/DBSchema/Messages.pm
line 12
I've tried this path as well in their respective modules above:
__PACKAGE__->has_many(messages => 'DBSchema::Messages');
__PACKAGE__->belongs_to(user => 'DBSchema::Users');
Any help is appreciated,
Kevin
--
Kevin Old
kevinold at gmail.com
More information about the Catalyst
mailing list