Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Building Web Apps with Sinatra Finishing Touches Deleting Pages

MaryAnn Eleanya
MaryAnn Eleanya
8,626 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,542 Points

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