开发者

Problem with deleting a photo object

I have this in my view,

<% @photos.each do |photo| %>
  <%= link_to "Destroy", photo, :method => "delete" %>
<% end %>

And I get an undefined method `photo_path' error.

I'm using paperclip.

And here's the extract from my rake routes.

DELETE /admin/issues/:issue_id/photos/:id(.:format) {:action=>"destroy",controller=>"admin/photos"}

Thanks!

UPDATE

  map.resources :issues, :has_many => [:notes, :photos]

  map.namespace :admin do 开发者_如何学Python|admin|
    admin.resources :issues 
    admin.resources :issues do |issue|
      issue.resources :photos
    end
  end


Have you mapped :photo as a resource in your routes.rb?


UPDATE

Based on your routes, maybe this would work:

<% @photos.each do |photo| %>
  <%= link_to "Destroy", admin_issue_photo_path(photo), :method => "delete" %>
<% end %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜