NISE Views

Wendy Raven McNair
3 min readSep 12, 2020
Photo by Daan Stevens from Pexels

A big part of my programming journey has been mentally organizing all the new and confusing information I’m learning. The CRUD processes for a Rails app were pretty daunting, until I realized Rails has nise views. And, no, I did not misspell NISE.

What are NISE views? NISE are the erb files inside the views folder.

N is for new. The new erb file is responsible for showing the user a form to fill in information to create something new, whether that’s a user, a tweet, or a session.

I is for index. The index erb file is responsible for showing the user all instances of a specific object, like all users, all tweets, or all sessions.

S is for show. The show erb file is responsible for showing the user a single instance of a specific object, like a specific user, a specific tweet, or a specific session.

E is for edit. The edit erb file is responsible for showing the user a form to fill in to change the information of something that’s already been created, whether that’s changing information about a specific user, a specific tweet, or a specific session.

The description for each file in NISE included the phrase “showing the user” because the user will see or Read the information from these files in their browser window. NISE represent the R in CRUD. CRUD is Create, Read, Update, and Delete. So that means that the NISE files are the Read functionality in CRUD.

The controllers folder contains controller files for things like users, tweets, or sessions. Since the controllers contain actions that drive not only the Read process but the full CRUD processes, I was able to further mentally organize the process. Read is represented by NISE, so read isn’t actually a controller action but NISE (new, index, show, and edit) are all controller actions.The remaining 3 (CUD) actions are create, update and delete.

So if we start with NISE:

*New

*Index

*Show

*Edit

And then add in the remaining CUD:

*New

>Create

*Index

*Show

>Delete

*Edit

>Update

We have all 7 RESTful actions. RESTful stands for REpresentational State Transfer and it’s a standard way that URLs are organized in web apps. This process facilitates communication through the internet between your computer browser and a server (computer that stores data). And here’s how:

* NEW controller action sends a form to your computer browser so you can fill it out and submit it to create an object (of a user, a tweet, or a session).

> CREATE controller action receives that information and uses it to create the new object specified.

* INDEX controller action sends a page containing a list of all of something that you can view on your computer. The list items can be individually linked so you can click and be shown details of a specific creation.

* SHOW controller action sends a page so you can be shown details of a specific list item.

> DELETE controller action receives a notice to delete this specific item.

* EDIT controller action sends a form so you can fill it out to edit information for a specific item.

> UPDATE controller action receives that information and uses it to change the information for the item specified.

The Rails file structure is now more comprehensible because the controller actions reside in their respective controller files which are all stored in the controllers folder. And the NISE erb files are located in their respective folders which are all stored in the views folder. Before this mental organization, Rails CRUD processes were very confusing. But now I see Rails has NISE views, very nice indeed.

Photo by Lukas Rychvalsky from Pexels

--

--