routing errors in rails application -
so i'm getting error in rails app:
no route matches {:action=>"edit", :controller=>"parties"}
in routes.rb file have set:
resources :parties under directory views/parties/show.html.erb view show.html.erb contains line:
<%= link_to "edit party details", edit_party_path %><br /> this works. however, under directory views/users/show.html.erb contains line:
<%= link_to "edit parties", :controller => 'users', :action => 'edit_parties' %> inside edit_parties.html.erb have loop prints out user's parties , link edit them. link looks this:
<li><h2><%= link_to party.title, edit_party_path %></h2><%= party.description %></li> this error occurs. why edit_party_path not work here, works above? because edit_party_path inside edit_parties.html.erb has no id grab?
i think diagnosis correct.
try instead (note argument edit_party_path):
<li><h2><%= link_to party.title, edit_party_path(party.id) %></h2><%= party.description %></li> see http://guides.rubyonrails.org/routing.html#paths-and-urls
it seems in show.html.erb, edit_party_path able infer id somehow.
Comments
Post a Comment