Adding redirect to baked controllers so when no delete could be done an

error page is not displayed.
Fixes #188

Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
Juan Basso 2010-01-11 13:46:21 -02:00 committed by Mark Story
parent 11a5403aaf
commit 5149d65c7e

View file

@ -386,6 +386,12 @@ class ControllerTask extends Shell {
$actions .= "\t\t\t\$this->flash(__('{$singularHumanName} deleted', true), array('action' => 'index'));\n";
}
$actions .= "\t\t}\n";
if ($wannaUseSession) {
$actions .= "\t\t\$this->Session->setFlash(__('The {$singularHumanName} could not be deleted. Please, try again.', true));\n";
$actions .= "\t\t\$this->redirect(array('action' => 'index'));\n";
} else {
$actions .= "\t\t\$this->flash(__('The {$singularHumanName} could not be deleted. Please, try again.', true), array('action' => 'index'));\n";
}
$actions .= "\t}\n";
$actions .= "\n";
return $actions;