0
這是我的routes.rbRails 3中沒有路由匹配(淺路由)
resources :subjects, :shallow => true do
resources :skills, :only => [:new, :create]
end
resources :skills
這是我的相關控制器(SkillsController)
def new
# if action is called by new_subject_skill_path then
# subject_id is not nil
if params[:subject_id]
@subject = Subject.find(params[:subject_id])
end
@skill = Skill.new
end
這是相關的觀點:(/人次/subject/show.html.erb)
<%= link_to 'Add new skill', new_subject_skill_path %>
這是結果,當我運行耙路線
new_subject_skill GET /subjects/:subject_id/skills/new(.:format) skills#new
然而,當我試圖使我得到以下錯誤
No route matches {:action=>"new", :controller=>"skills"}
什麼我做錯了的看法?
乾杯:-)