Say I have a table called customer which links to a parent table called status. I wonder if there is a shortcut so that I don't need to figure out the parent id in advance if I know the unique name.

my $status = $self->schema->resultset('Status')->search({status_name => 'new'})->single;

my $customer = $self->schema->resultset->create({
    name => 'Acme Corp',
    status_id => $status->id
})

I've had a peruse of the Cookbook, but couldn't see anything

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to