Skip to content

Commit

Permalink
Update codeblocks to include missing 'RequestHandler' component inclu…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
josegonzalez committed Oct 5, 2013
1 parent 0ba178b commit 28ca09b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions en/views/json-and-xml-views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ generating the response, you should use view files. The value of ``_serialize``
can be either a string or an array of view variables to serialize::

class PostsController extends AppController {
public $components = array('RequestHandler');
public function index() {
$this->set('posts', $this->paginate());
$this->set('_serialize', array('posts'));
Expand All @@ -56,6 +58,8 @@ can be either a string or an array of view variables to serialize::
You can also define ``_serialize`` as an array of view variables to combine::

class PostsController extends AppController {
public $components = array('RequestHandler');
public function index() {
// some code that created $posts and $comments
$this->set(compact('posts', 'comments'));
Expand Down

0 comments on commit 28ca09b

Please sign in to comment.