noob - nested resource and destroy

Hello

I have an articles controller and an admin/articles..routes.rb:

  map.resource :articles

  map.namespace :admin do |admin|        admin.resources :articles   end

Normally I could refer to the admin_article_path series of routes...edit_admin_article_path(asdf) for example - but a link_to for destroy isn't working out. It's looking in the Articles controller rather than the Admin::Articles controller.

I've tried:

<%= link_to 'Destroy', admin_article                        article                        admin_article_path

etc etc - always get an undefined local variable or method.

I did just notice in my controllers/admin/articles_controller.rb that I'm doing things like:

@articles = Article.find,etc rather than Admin::Article find - maybe this could be it..im crossing controllers up?

Any help would be greatly appreciated

Try this:

link_to "Destroy", admin_article_url(@article), :confirm => "Are you sure you want to delete this article?", :method => :delete

You can omit the confirm parameter if you wish.

BTW, the above uses javascript, so it won't work if your user has javascript disabled. The reason being for it is that the destroy call has to be wrapped in a POST method.