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 %>
精彩评论