if (!exists($self->config->{'id_field'})) {
- $self->config->{'id_field'} = 'id';
+ my @pks = $self->{'resultset'}->result_source->primary_columns;
+ if ($#pks == 0) {
+ $self->config->{'id_field'} = $pks[0];
+ } else {
+ Catalyst::Exception->throw("user table does not contain a single primary key column - please specify 'id_field' in config!");
+ }
+ }
+ if (!$self->{'resultset'}->result_source->has_column($self->config->{'id_field'})) {
+ Catalyst::Exception->throw("id_field set to " . $self->config->{'id_field'} . " but user table has no column by that name!");
}
## if we have lazyloading turned on - we should not query the DB unless something gets read.
my @roles = ();
if (exists($self->config->{'role_column'})) {
- @roles = split /[ ,\|]+/, $self->get($self->config->{'role_column'});
+ my $role_data = $self->get($self->config->{'role_column'});
+ if ($role_data) {
+ @roles = split /[ ,\|]+/, $self->get($self->config->{'role_column'});
+ }
$self->_roles(\@roles);
} elsif (exists($self->config->{'role_relation'})) {
my $relation = $self->config->{'role_relation'};
=head1 VERSION
-This documentation refers to version 0.02.
+This documentation refers to version 0.10.
=head1 SYNOPSIS