hi, got this situation. Reports habtm users. So im trying to paginate just the Reports that are linked to the Auth user... I read when you have a habtm relationship you have to bind the model temporarily using 'hasOne' like this:
funtion index(){
$conditions=array('ReportsUser.user_id'=>$this->Auth->User('id'), 'ReportsUser.report_id'=>'Report.id');
$this->beforeFind();
$this->Report->recursive=0;
$this->set('reports',$this->paginate($conditions));
}
funtion beforeFind()
{
$this->Report->bindModel('hasOne'=>array('ReportsUser'), false);
}
so here is the issue... that doesn't work... that give me no results... I already checked the database for user having any Report, and i logged in with one of those user...
any suggestions?