2014-01-19 20 views
0

我有Lessons屬於Courses。我想要一個額外的教訓來重定向到該課程的課程索引,而不是整個課程索引。在子控制器中獲取父變量

我在add()功能試過這樣:

return $this->redirect(array('controller' => 'courses', 'action' => 'view', $this->Lesson->Course->$id)); 

但重定向不能正常工作。我該如何使它回到 http://www.example.com/courses/view/2

謝謝!

回答

0

$ this-> Lesson-> Course - > $ id不會爲您提供課程編號。

我想課程ID已經在請求中了,$ this-> request-> data ['Lesson'] ['course_id'];

相關問題