Permalink
Browse files

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>
  • Loading branch information...
1 parent 11a5403 commit 5149d65c7e5516d255b507ee61fe709983f1c874 @jrbasso jrbasso committed with markstory Jan 11, 2010
Showing with 6 additions and 0 deletions.
  1. +6 −0 cake/console/libs/tasks/controller.php
@@ -386,6 +386,12 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$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;

0 comments on commit 5149d65

Please sign in to comment.