The Bull Og

Onine since 1994. Offline since 1976.

See also the archive

An individual post follows.

I searched around couldn't find anything definitive, but I put the following together based on what I could find.

Before you start making changes to your model(s,) use a line like this:

$c->model('MyAppDB')->storage->txn_commit;

... and add make sure this is in the "end" method of the module where you're doing the changes:

sub end : Private {
     my ( $self, $c ) = @_;

     if ( scalar @{ $c->error } ) {
         $c->log->error(@{$c->error}[0]);
         $c->stash->{errors}   = $c->error;
         $c->stash->{template} = 'error.tt';
         $c->forward('MyApp::View::TT');
         $c->error(0);
         $c->model('MyAppDB')->storage->txn_rollback;
     } else {
         $c->model('MyAppDB')->storage->txn_commit;
     }

     # wrap up...
}