Bummer! This is just a preview. You need to be signed in with a Pro account to view the entire video.
Deleting Entries from a Table2:13 with Andrew Chalkley
In this video we'll remove rows of data from a table.
We have only one good operation left.
There are two actions that deal with deleting.
A human friendly form.
And a route that deals with the deleting of the entry.
Let's start by using SQL Ice to find the article for the delete form.
Then down in the delete method route, let's find the article
Once the article is found, we can destroy it.
The destroy method is an asynchronous call that returns a promise.
Once the promise is fulfilled, then we want to redirect to the article's path.
Let's restart the server and see if we can delete an article.
We can, awesome!
All of our code operations are done.
So, we're done right?
Wrong, we haven't handled any errors.
In the next video, I'll show you how to handle validation failures and
Like if a record is missing or if other unforseen errors occur.
You need to sign up for Treehouse in order to download course files.Sign up