2

I would like to create link for method edit which has to have link like that: /presentation/:id/edit.

 <% @presentations.each do |p| %> 
     <a >  <%= p.id %>
     <a href="<%= presentation_path(p) %>" target="_blank" class="action"> Show </a> 
     <%= link_to "Delete", p, method: :delete %>
     <%= link_to "Edit", '/presentation/:id/edit', {target: "preview" } %>
    </a>
   <% end %>

my link above is giving me error: RuntimeError in PresentationController#edit

Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id

4

1 回答 1

2

go to terminal and execute

$ rake routes

and you will find text like this: edit_presentation. So replase your '/presentation/:id/edit' to edit_presentation_path It will help

于 2013-10-25T14:32:40.427 回答