Permalink
Browse files

Fixing non output of flash messages from Scaffolds when controller is…

… not using Sessions. Refs #64
  • Loading branch information...
markstory committed Aug 31, 2009
1 parent 9c82d19 commit 84b230413a7e46d94a6b899b06e68945c52cc20c
Showing with 8 additions and 7 deletions.
  1. +8 −7 cake/libs/controller/scaffold.php
@@ -334,10 +334,8 @@ function __scaffoldSave($params = array(), $action = 'edit') {
));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(
- __('The %1$s has been %2$s', true),
- Inflector::humanize($this->modelClass), $success
- ), $this->redirect);
+ $this->controller->flash(sprintf(__('The %1$s has been %2$s', true), Inflector::humanize($this->modelClass), $success), $this->redirect);
+ return $this->_output();
}
} else {
return $this->controller->_afterScaffoldSaveError($action);
@@ -393,9 +391,10 @@ function __scaffoldDelete($params = array()) {
));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(
+ $this->controller->flash(sprintf(
__("No id set for %s::delete()", true), Inflector::humanize($this->modelKey)
), '/' . Inflector::underscore($this->controller->viewPath));
+ return $this->_output();
}
if ($this->ScaffoldModel->delete($id)) {
@@ -406,10 +405,11 @@ function __scaffoldDelete($params = array()) {
));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(
+ $this->controller->flash(sprintf(
__('The %1$s with id: %2$d has been deleted.', true),
Inflector::humanize($this->modelClass), $id
), '/' . $this->viewPath);
+ return $this->_output();
}
} else {
if ($this->_validSession) {
@@ -419,10 +419,11 @@ function __scaffoldDelete($params = array()) {
));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(
+ $this->controller->flash(sprintf(
__('There was an error deleting the %1$s with id: %2$d', true),
Inflector::humanize($this->modelClass), $id
), '/' . $this->viewPath);
+ return $this->_output();
}
}
} elseif ($this->controller->_scaffoldError('delete') === false) {

0 comments on commit 84b2304

Please sign in to comment.