Skip to content
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...
jrbasso authored and markstory committed Jan 11, 2010
1 parent 11a5403 commit 5149d65c7e5516d255b507ee61fe709983f1c874
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.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.