I think you need to retrieve that object after ->update() again:



Character.pm
-----------------------------------
sub character : Local FormConfig('character/character.yml') {
 my ($self, $c, $id) = @_;

 my $book;

 if (defined($id)) {

     $book = $c->model('DB::Character')->find($id);

     unless ($book) {
$c->stash->{error_msg} = "Invalid Character record -- Cannot edit";
         $c->response->redirect($c->uri_for('list_character'));
         $c->detach;
     }
 } else {

     $book = $c->model('DB::Character')->new_result({});
 }

 my $form = $c->stash->{form};

 if ($form->submitted_and_valid) {
     $form->model->update($book);

      $book = $c->model('DB::Character')->find($book->id);

     $c->stash->{status_msg} = 'Record ammended';
     $c->response->redirect($c->uri_for('list_character'));
     $c->detach;
 } else {
     $form->model->default_values($book);
 }

 $c->stash->{given_title} = 'Edit Character';
 $c->stash->{template} = 'character/character.tt2';
}



_______________________________________________
List: [email protected]
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/

Reply via email to