From the course: Ruby on Rails 6 Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Delete actions: Delete and destroy

Delete actions: Delete and destroy - Ruby on Rails Tutorial

From the course: Ruby on Rails 6 Essential Training

Start my 1-month free trial

Delete actions: Delete and destroy

- [Instructor] We've now learned how to read, create, and update records. The remaining CRUD action is delete. Delete is also made up of two different actions. Delete and destroy. Delete would display a delete record form and Destroy would actually do the destruction of the record of the database. Notice that the RESTful route for destroy is going to use delete as its verb. There are a few other points we need to keep in mind. Delete and destroy are going to require an ID to be sent so that they can find an existing record and that just makes sense. You can't delete a record if it doesn't exist in the database. Delete is going to use find to find the record and destroy will use find and destroy. Now it can get confusing because the HTTP verb that we're using for destroy is called delete and there's also a rails method called delete that we can call on the object as well. But we want to make sure we're using destroy…

Contents