Re: Routing error (route not found) but only for destroy action.

Frederick Cheung
Mon, 22 Aug 2011 13:32:06 -0000

On Aug 22, 1:28 pm, 7stud --
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:

> Once you have a way to execute a method when you have the name of the
> method as a string, you can get creative:
>
> model = item_to_destroy.class.to_s.downcase
>
> self.send("#{model}_path", item_to_delete)
>

or polymorphic_path(item_to_delete) (which is what gets called if you
do button_to(''delete'', item_to_delete, :method =>