From 5149d65c7e5516d255b507ee61fe709983f1c874 Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Mon, 11 Jan 2010 13:46:21 -0200 Subject: [PATCH] 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 --- cake/console/libs/tasks/controller.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index 428cdcebe..d4ab58abe 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -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;