Skip to content

Commit

Permalink
CakeRequest::is() can take an array.
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-shatskyi committed Oct 19, 2013
1 parent cb61c22 commit 744662f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions en/tutorials-and-examples/blog/part-two.rst
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ like::
throw new NotFoundException(__('Invalid post'));
}

if ($this->request->is('post') || $this->request->is('put')) {
if ($this->request->is(array('post', 'put'))) {
$this->Post->id = $id;
if ($this->Post->save($this->request->data)) {
$this->Session->setFlash(__('Your post has been updated.'));
Expand All @@ -460,7 +460,7 @@ This action first ensures that the user has tried to access an existing record.
If they haven't passed in an ``$id`` parameter, or the post does not
exist, we throw a ``NotFoundException`` for the CakePHP ErrorHandler to take care of.

Next the action checks that the request is a POST request. If it is, then we
Next the action checks whether the request is either a POST or a PUT request. If it is, then we
use the POST data to update our Post record, or kick back and show the user
validation errors.

Expand Down

0 comments on commit 744662f

Please sign in to comment.