Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorprtscr
     

    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!

    • CommentAuthorarthur
     

    Make the include value an array, like so:

    $this->post = $this->Post->find(@$this->params['id'], array('include' => array('category', 'comments')));
    

    Good luck!

    • CommentAuthorprtscr
     

    Thanks, it works very well!