In the software development perspective, CRUD is basically the four operations (create, read, update, and delete) of data storage, regarded collectively.
- Create: This operation would create a brand new entity. In terms of
database, this corresponds to the
- Read: This operation would read something from the database and would not make any permanent changes to the database.
- Update: This operation would change the values of an already existing entity.
- Delete: This operation would delete an entity from the database.
CRUD in action
The operation we are performing during each route action is listed below:
|VERB||URI Pattern||Controller#Action||Used for||Operation|
|POST||/books||books#create||Create a book||CREATE|
|GET||/books/new||books#new||Form for a new book||READ|
|GET||/books/:id||books#edit||Form for editing book||READ|
|GET||/books/:id||books#show||Show info about book||READ|
|PATCH||/books/:id||books#update||Update info about book||UPDATE|
|PUT||/books/:id||books#update||Update info about book||UPDATE|
|DELETE||/books/:id||books#destroy||Delete info about book||DELETE|
As we can see each of those seven actions could be assigned to one of these four operations - Create, Read, Update and Delete.
REST and CRUD
REST is an architectural system that deals with data through HTTP protocols. You can read more about REST style here.
Typically software applications create RESTful APIs to handle CRUD operations. You can read more about CRUD operations here
There aren't any changes to the application in this chapter. So let us clean up any accidental changes.
1git clean -fd