DEV Community

Christopher Mrakovcic
Christopher Mrakovcic

Posted on

My Sinatra Project

I wrote my first Sinatra web app. My app starts off by allowing the user to create an account through email, and password. My app was created with my passion in mind, video games. The user will use my app in order to create a collection of their video games along with the date that they purchased the video game.

The associations that I included are a User model which is related to a Videogame model. The User model holds a has_many relationship with the Videogame model allowing for more than one video game to be associated with a user. The video game in question was only able to be to paired with a single owner as it holds a belongs_to relationship with the user. A foreign key was used to connect the user to the video game.

I was then able to produce information about any video game that was created by a single user and through the use of the authenticate method to ensure only the user who created this record was able to edit or delete this information. The information only contained the video games title, and date purchased. I allowed users to be able to view other users video game collection since it does not include private personal information in my.

Top comments (0)