Building a Full CRUD Rails App
CRUD is shorted for create, read, update, delete. When a Rails app uses all four, it is a full CRUD app. Here, I will show you how to build one. First off, we want to create a new user like so.

Here, we are creating a new user with a username, email, and password that is replaced by the “user_params” in Create.
Next step is show the user.

The “def show” is here to show the user after it was created. From “create”, after the user is created, we redirect it to the user’s page. Another way to show is to use “index” that shows all of the users.

Now the app can just create and read. Now let’s show how to update the user.

To update, we need to use “edit” to find the user. Then we want to update the username. The line “@user.update(username: params[:user][:username]) will change the username for the user. Click “update” and it will redirect to the user’s page.
The final thing to do is now destroy. Destroy is meant to delete all info regarding the user, like deleting a social media profile.

First, we find the user. Once it is found, then this will delete the user and redirect back to the new user path to create a new user by default.
Now, we can see that creating a full CRUD Rails app is not too difficult. The full program is in figure 6.

Lastly, we must discuss routes. The purpose of routes is to determine where we can and cannot go. If we are to build a full Rails CRUD app, we need the routes to be able to go anywhere we want. The default will be just resources :users
. Sometimes, we can be explicit and say resources :users, only: [:index, :show, :create, :edit, :update, :destroy]
. However, that is not always the case. If we just want to show all, the route would be just resources :users, only: [:index]
. Another for just all users and click the name to see one is resources :users, only: [:index, :show]
. If we want edit, we add edit and update to it.
So this shows a basic way to build a full CRUD app for Rails. Writing the files here is a great way to start.