Hi all,

I'm trying to implement an admin control panel for my application and
everything seems to work fine, except when I try to call the destroy
method from the view. I really tried to search for a solution, reading
some routing rails articles, but can't figure out what's going on.
When I call the method from the console it works. Calling it from the
view redirects to the list action, but the product is not deleted.

View:
-------
<% for product in @products %>
   <%= link_to 'delete', [:admin, product],:confirm => 'Are you
sure?',:method => :delete %>
<% end %>

My routes.rb:
-------------------
map.namespace :admin do |admin|
    admin.resources :categories
    admin.resources :subcategories
    admin.resources :products
end

Controller:
--------------
def destroy
  @product = Product.find(params[:id])
  @product.destroy
  respond_to do |format|
    format.html { redirect_to(products_url) }
  end
end

Thanks for your help,

--
Alberto

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to