我有一個Step模型和一個MasterStep模型。在我的控制器中,我使用這個,並且沒有任何任何地方使用MasterStep的任務。錯誤地分配了實例變量
@step = Step.all(:conditions => {:course_id => params[:id], :current_state => :incomplete}, :order => :id).first
這是我的錯誤日誌。注意MasterCourse: http://pastie.org/2252224
下面是相關方法: http://pastie.org/pastes/2252198/text
我無法弄清楚它是如何得到一個MasterStep對象,並在整個代碼庫,我找不到任何多數民衆贊成分配@步驟到MasterStep對象。
這怎麼可能?
大部分操作是引用'@ step.master_step' ...我假設控制器的第110行是這一行:'@course = @ step.master_step.master_course'。 – sevenseacat
在你現在的方法中有'@course = @ step.master_step.master_course'這一行。所以在你的MasterStep模型中有一個叫做master_course的方法? – drummondj
我錯過了我的模型中的一些東西,我應該一直在做master_step.master_section.master_course – SpaceGhost