Project #2 — Sinatra
One step closer in my software engineering bootcamp journey. I have completed my second project! It is a Content Management System Application using Sinatra. I decided to create an application which allowed the users to create a grocery list and the quantity for each item, and then delete the item as it has been purchased. I decided to my concept simple with two models (Users and Items) to allow me dive deep and understand the concepts of the curriculum.
The users in my application can sign up, login and log out. In addition, they can create, read, update and delete the items in their list. Users do not have the ability to update or delete items that do not belong to them. Items have name and quantity attributes.
I used the Corneal gem to begin my project which created a ton of the basics in my project. Then I created my ActiveRecord database and the Users and Items tables. After that, I set up my models and my application controller.
One of my biggest struggles with this project was trying to figure out why my login route was not working. A user had the ability to sign up, but it wasn’t recognizing the user logging in. I finally figured out a had a dang spelling error!!!! *Face Palm* instead of
I had written,
It seems like a small error, but it was preventing a user from being able to login. Also, it meant if user couldn’t actually log in, they couldn’t add items to their lists. My entire project wasn’t going to work until I fixed it! I realized how important it is to try to be aware of every little detail as I am coding.
One of my favorite things to add to this project was the gem ‘sinatra-flash’. In my opinion, adding the flash gem to be able to display errors to the user definitely makes for a better user experience. Before adding the flash gem, whenever a user tried to signup with an existing username, my application was just redirecting them back to the signup page without letting the user know what happened. I think if I was an average person this would be really confusing for me, and I would just assume there was an issue with the website rather than an issue with my input. Now, if a person tries to signup as a user with a username that is already in use it will display an error message! Woohoo for clarity.
I really enjoyed creating this project. I find it interesting how the Models, Controllers, and Views all work together. When I first began the Sinatra section of Flatiron, I was super intimidated about all of the different files and I couldn’t make sense of how they all worked together. Now I feel like it’s totally making sense. I think having some “ground rules” like RESFUL routes definitely made things clearer for me. I’m excited to continue to learn and develop my knowledge as a software engineer.