Forum: Ruby on Rails Request type error thrown on delete request

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chris O. (Guest)
on 2009-01-18 03:46
For some odd reason when I make javascript delete requests the destroy
is performed, but then I get an error message back saying that only get,
delete and put requests are allowed.

Here is some global js that binds all the delete links within tables

function bind_table_destroys() {
  $("table.data a.destroy").click(function() {
    if (!confirm("This item will be permanently removed"))
      return false

    var link = $(this)
    $.post(this.href + ".js", "_method=delete", function() {
      // remove the row from the table
      link.parent().parent().remove()  // a->td->tr
    })
    return false
  })
}

The routing seems good since the destroy action is called. To be honest
I wouldn't be able to tell that an error occured unless I read the
respnose text within firebug.

Does anyone have any clues to the problem?

Thanks for the help
This topic is locked and can not be replied to.