0
我有以下的路線設置:命名路線及的link_to問題
map.people 'people(.:format)', :conditions => { :method => :get }, :controller=>"people", :action=>"index"
map.connect 'people(.:format)', :conditions => { :method => :post }, :controller=>"people", :action=>"create"
map.new_person 'people/new(.:format)', :conditions => { :method => :get }, :controller=>"people", :action=>"new"
map.edit_person 'people/:shortname/edit(.:format)', :conditions => { :method => :get }, :controller => 'people', :action => 'edit'
map.person 'people/:shortname(.:format)', :conditions => { :method => :get }, :controller=>"people", :action=>"show"
map.connect 'people/:shortname(.:format)', :conditions => { :method => :put }, :controller=>"people", :action=>"update"
map.connect 'people/:shortname(.:format)', :conditions => { :method => :delete }, :controller=>"people", :action=>"destroy"
我想使用的link_to函數的視圖頁面像:
<%= link_to 'Show', person_path(person.shortname) %>
這給了我這個錯誤,我不知道我做錯了:
person_url failed to generate from {:controller=>"people", :shortname=>"efleming", :action=>"show"}, expected: {:controller=>"people", :action=>"show"}, diff: {:shortname=>"efleming"}
謝謝,這是一個非常愚蠢的錯誤,就像一個魅力。 – efleming