2013-07-05 57 views
0

我創建了這樣的Rails的路線Resources會員發行

resources :subjects do 
    resources :subject_edits do 
     member do 
     post :vote 
     end 
    end 
    end 

嵌套的路線,當我運行rake routes,我發現它退出

vote_subject_subject_edit POST /subjects/:subject_id/subject_edits/:id/vote(.:format) subject_edits#vote 

但是當我使用它在我的.erb文件

<%= button_to 'I Agree', :action => vote_subject_subject_edit_path(@subject, @edit) %> 

我得到一個錯誤,

沒有路線匹配{:action =>「/ subjects/25/subject_edits/1/vote」, :subject_id =>「25」,:id =>「1」,:controller =>「subject_edits」}

這裏有什麼問題?

回答

0

這個助手設置網址明確,所以你需要:

<%= button_to 'I Agree', vote_subject_subject_edit_path(@subject, @edit) %> 

沒有通過:action選項。