Ruby Building Web Apps with Sinatra Finishing Touches Deleting Pages

MaryAnn Eleanya
MaryAnn Eleanya
8,149 Points

Don't understand why my delete method isn't working.

Don't understand why my delete method isn't working.

This is what I have: show.erb <form method="post" action= "/<%=@mediums.name%>"> <input name="_method" type="hidden" value="delete"> <input type="submit" value="Delete name"> </form>

test.rb

class Test < Sinatra::Base

delete ("/@mediums.name") do @mediums.name = Mediums.find(params[:id]) @mediums.destroy redirect "/names" end

end

1 Answer

Houston Erekson
Houston Erekson
10,381 Points

Your form is set to the POST method instead of the DELETE method.