I have a nested resource under my admin namespace:
The admin/topic/comments_controller.rb is a resource under admin/topics_controller.rb.
namespace :admin do
resources :topics do
resources :comments, :controller => "topic/comments"
end
end
gives me this delete route:
DELETE
/admin/topics/:topic_id/comments/:id(.:format)
admin/topic/comments#destroy
And I am creating a link to destroy comments, like the following:
# comment = @topic.comment.first
<%= link_to "Destroy", [:admin, comment], :method => :delete %>
produces the following route:
/admin/topics/165/comments/11
All seems correct, except that the two ids are swapped around. What am I doing wrong?
You can use the name_route instead :