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

7stud --
Tue, 23 Aug 2011 00:49:26 -0000

Frederick Cheung wrote in post #1017860:
> On Aug 22, 1:28pm, 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 =>
''delete'') )
>

So what you are saying is that rails automatically does all that for you
under the hood--if you specify a model object for the path in
button_to()?

--
Posted via http://www.ruby-forum.com/.