Adeola Awoyemi wrote: > Hi all, > > I'm using DBIx::Class and trying to get the 'id' back from a create() > call but I get nothing. > > I have something like: > > # db table also has an 'id' column which > # is set to auto_increment. > my $m = $c->model('MyAppDB::Foo'); > my $res = $m->create({ > name => 'adeola', > message => 'all for the sake of testing', > }); > $c->log->debug("# ID OF LAST INSERT: " . $res->id); > > So, instead of getting an id, I get nothing, not even 'undef' or > something like that. But the other fields (e.g. $m->name) returns what I > expect. > > How do I get the 'id' of the resultset back? Am I missing something? > > Thanks for your help, > Adeola.
Have you set_primary_key on that result source? Does the id column have an is_auto_increment attribute? (Also s/resultset/row/; and there is a dbix-class mailing list where this would be better sent: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class ) _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/