I've got a model post that belongs to category and has many comments. In the show action I want to show both which category the specific post belongs to and it's comments. I've tried something like this, but can't get it to work.
function show()
{
$this->post = $this->Post->find(@$this->params['id'], array('include' => 'category', 'comments'));
}
How to include both category and comments?
Thanks in advance!
Make the include value an array, like so:
$this->post = $this->Post->find(@$this->params['id'], array('include' => array('category', 'comments')));
Good luck!
Thanks, it works very well!
1 to 3 of 3