DEV Community

abnercabrera28
abnercabrera28

Posted on

Sinatra Project

It's the end of the second month of my online software engineering class, which means there's a final project due. This time I had to build a Sinatra application and, much like my last project, I had no idea what I would be designing it around. After much deliberation, I decided I would be making an application where a user can store their favorite wrestlers.

The process began with creating my users and wrestlers table, where users had a username and a password, and wrestlers had names, birthdates, belts, and special moves. Then I set up models for both tables, declaring their relationship: users have many wrestlers and wrestlers belong to users.

Up next were the controllers. I created them for the wrestlers and users, as well as a session controller, all of which inherited from the application controller that had my helper methods and a route for my home page. I coded in the routes for logging in and out in my sessions controller, and the routes for signing up in my users controller. The wrestlers controller had the routes for creating, reading, updating and deleting wrestlers (good old CRUD).

All that was left were the views to complete my requirements. I created the ERB files that pertained to each route I coded in. The new file has a form where a user can create a new favorite wrestler by inputting their information. After they submit their form, they're taken to the wrestlers route, which has a list of all the wrestlers a user has created. If you click on a wrestler, it shows all the information about them, which is generated from show ERB file. On this same page, a user can choose to edit information about that particular wrestler or delete them completely.

I finished doing what I was required to do for my project, which did not take as long as it did for me to complete my CLI project last month. However, the page looked a little boring, so I decided to style it. I used a combination of Bootstrap and a CSS stylesheet to make my Wrestlr page (that's the name of the website) look much prettier. I spent most of my time stylizing the project than I did in doing the requirements. I had such a terrible time trying to make my create and edit forms look good that I decided to give up on it and submit as it was. The important thing is that it works right? All in all, this project was much easier to complete than my previous one and I had a good time doing it.

Top comments (0)