I’m running into a dilemma here. The Firefox Add-Ons SDK only allows PUT and POST requests via its API. I am using the following route in Rails: “resource :users”
I can easily override the PUT to be:
"match 'users/:id' => 'users#update', :via => [:post, :put]
However, I can’t do this again for DELETE as I also need to :post to the same URL again. Do I need to create a new route all-together and abandon the resourceful way of doing things? Is there a way to have POST behave like a DELETE on the Firefox side instead?
There is currently no way to do this in the high-level Request api, however you could implement something using the lower level xhr api:
https://addons.mozilla.org/en-US/developers/docs/sdk/1.2/packages/api-utils/docs/xhr.html
This provides access to Firefox’s underlying XmlHttpRequest implementation:
https://developer.mozilla.org/En/Using_XMLHttpRequest