1

I have followed the basic uses of CAKEDC RATING plugin but unable to get it work. after clicking "Rate" button on the view it does not saving the data in table "ratings".

PostController:

public $components = array('Paginator', 'Session','Ratings.Ratings');

posts/view:

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

I have debugged the posted data in RatableBehavior near line 154:

$Model->Rating->create();
debug($data);
exit;

output:

 array(
        'Rating' => array(
            'foreign_key' => '2',
            'model' => 'Post',
            'user_id' => null,
            'value' => '5'
        )
    )

user_id is the primary key of the users table and id of posts.

How can I fix it?

Micha Wiedenmann
  • 19,979
  • 21
  • 92
  • 137
Faiyaz Alam
  • 1,191
  • 9
  • 27

0 Answers0