Search code examples
phpcakephpratingcakedc

CakeDC Ratings stars do now appear and data is not saved


I am trying to add CakeDC ratings to my CakePHP website. I have followed the instructions in readme provided with the plugin, but the rating stars do not appear. Also the ratings are not saved when I press 'Rate'. Here is the code from the view file:

<h3><?php echo ($post['Post']['title']); ?></h3>
<?php echo $this->Rating->display(array(
'item' => $post['Post']['id'],
'type' => 'radio',
'stars' => 5,
'value' => $post['Post']['rating'],
'createForm' => array('url' => array_merge($this -> passedArgs, array('rate' => $post['Post']['id'], 'redirect' => true)))));?></h3>

After pressing "Rate", the url changes to '.../rate:2/redirect:1' , but the data does not appear in the database. Am I missing something?


Solution

  • i also encountered this problem, but what i did was, i added this

    public $components = array('Ratings.Ratings');
    public $actsAs = array('Ratings.Ratable');
    

    and after that, it managed to save the data