Skip to content

Instantly share code, notes, and snippets.

@reboryan
Created May 15, 2014 15:31
Show Gist options
  • Select an option

  • Save reboryan/efa56f2c4d86f9cc1d1a to your computer and use it in GitHub Desktop.

Select an option

Save reboryan/efa56f2c4d86f9cc1d1a to your computer and use it in GitHub Desktop.
PUT and DELETE routes
#IN THE CONTROLLER
put '/update_blog_post' do
#do stuff to update record
end
delete '/delete_blog_post' do
#do stuff to delete record
end
<!--TO ALLOW PUT REQUEST:-->
<form method="post" action="/update_blog_post">
<input type="hidden" name="_method" value="put">
<input type="text" name="title" value="title">
<input type="text" name="body" value="body">
<input type="submit" name="submit_edit">
</form>
<!--TO ALLOW DELETE REQUEST:-->
<form method="post" action="/delete_blog_post">
<input type="hidden" name="_method" value="delete">
<input type="text" name="title" value="title">
<input type="text" name="body" value="body">
<input type="submit" name="submit_edit">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment