I have the tables Semesters, Disciplines and a jointTable Semesters_Disciplines. I want to create a action index in DisciplinesController with a semester_id as parameter, which list with paginate just the disciplines what belongs to the semester with the id passed in the parameter. I tried this:
public function index($semester_id)
{
$options = ['semester_id' => $semester_id];
$this->paginate = ['conditions' => $options];
$this->set('disciplines', $this->paginate($this->Disciplines));
$this->set('_serialize', ['disciplines']);
}