REST, Internet Explorer and the banned DELETE method

Hi all

As we all know, in REST the ResourceController#delete action is called
by calling “/resources/:id” with a delete method. But, the delete
method is not supported in IE. This seems like a problem to me. How do
people get around this, typically? I can think of various ways around
it but they all seem a bit bodgy and i’d like to know some other
approaches or even if there’s something really obvious that i’m missing.

Hi,
You just cat you following in your view:
<%= link_to ‘Destroy’, photo, :confirm => ‘Are you sure?’, :method
=> :delete %>
and it appear in browser to that:
Destroy

as you can see its still post, but it has hidden input that tells your
controller about delete.

*your just CAN ADD (sorry for this typo)…

DmitryPush wrote:

Hi,
You just cat you following in your view:
<%= link_to ‘Destroy’, photo, :confirm => ‘Are you sure?’, :method
=> :delete %>
and it appear in browser to that:
Destroy

as you can see its still post, but it has hidden input that tells your
controller about delete.

Ah yes, of course, i had the feeling that rails handled this with a bit
of subterfuge but couldn’t remember quite how. I actually tried this
with a link_to_remote and the generated html was just a call to
jQuery.ajax with the delete method, just as i’d done it already, rather
than the code you posted up. I wonder if this is an issue with the
jrails plugin, which overrides the javascript generated by rails’ remote
helpers.

I’m actually doing it in javascript (in a jQuery.ajax call) anyway, so
lets see if changing the method to post and adding “_method=delete” to
the data has the same effect…yes it does. Great, thanks Dmitry!

by the way, the same story about PUT

..........

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs