a Redirect_to from Destroy action always gets DELETE verb whatever :method I declare

rest, ruby-on-rails

Solution

Solved though not in a nice way..

created the following route:

match 'mostrar_cliente/:id' => 'clientes#show', :via => :delete 

then I rewrote the redirect as:

redirect_to "/mostrar_cliente/#{@tarea.cliente}", :format => :js

not a very clean solution, but working as intended :)

Problem

I have the following method in a controller named `tareas_controller` ``` def destroy @tarea = Tarea.find(params[:id]) @tarea.destroy respond_to do |format| format.html { redirect_to tareas_url } format.json { head :ok } format.js { redirect_to :controller => "clientes", :action =>"show", :id => @tarea.cliente, :format => :js, :method=>:get} end end ``` The record gets deleted ok, after that I get the following code on the server: Redirected to http://127.0.0.1:3000/clientes/12.js?method=get Completed 302 Found in 174ms Started DELETE "/clientes/12.js?method=get" for 127.0.0.1 at 2012-05-06 19:20:07 +0200 Processing by ClientesController#destroy as JS Parameters: {"method"=>"get", "id"=>"12"} Cliente Load (0.0ms) SELECT "clientes".* FROM "clientes" WHERE "clientes"."id" = ? LIMIT 1 [["id", "12"]] SQL (2.0ms) DELETE FROM "clientes" WHERE "clientes"."id" = ? [["id", 12]] Completed 406 Not Acceptable in 131ms It seems to send the request with a DELETE verb to the new controller and I cant find a way to change that to a GET request to the new controller. Can someone give me advise as to how to resolve this issue?

Original source