Hi alberto!
I don't think your syntax is the problem here, [:admin, product] or
admin_product_path should work fine.
I'm afraid I can't work out what's going wrong but why not try adding
"logger.info('message here' )" to your controller both before and
after the destroy call.
You can then check your log and find out what code is being run and
what isn't. Also, do you have anything in your model that may be
causing an issue, a :before_destroy perhaps?
Gavin
On Nov 23, 6:24 pm, cardinallijr <[EMAIL PROTECTED]> wrote:
> 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---