Sinatra Project — Game Logger
Long time no post…
I need to get better about posting items to my coding blog, but for this project, I decided to work recreating a spreadsheet I currently have in real life. A “log” of games I play, a backlog of un-played games, or games coming out. It’s a simple Sinatra app that can definitely grow into something larger if I want to incorporate Rails in the future or grow my proficiency in Sinatra.
My idea for the project actually came from a spreadsheet I keep for myself already, but thought it would be cool to recreate that or similar recreation of that via app form. It’s a simple and standard premise. I like keeping a log of the games I play, want to play, or are coming so I don’t forget in this busy life of working and doing Flatiron at the same time. So, that’s what I did.I found the understanding of routes fairly straightforward. That could be do to my IT background and understanding of a file structure, permissions and security that I handle currently. Naturally, inheritance and file structure are based on the routes they inherit. I used the same mentality and knowledge here and tried to reapply it to CRUD.
The initial pause I had was actually the premise of IDs. When creating each “item” or entry. I had to wrap my head around that they were stored into their individual IDs and how to update those and make sure they were assigned only the individual that was logged in.
Authentication came into play to verify the user was logged and it was pulling from the current user using the helpers. I think that was the key here.
These ensured we using CRUD on the correct user and not another user’s content. After that, it was just a matter of making sure it was being shown or grabbed from the correct ID of the game and current user that was logged in and patching or saving it into that user’s personal content.
After entering the entry it then shows the entry you just entered as a “confirmation”. Could I have done without this page? I certainly could have but as a personal choice for my first app I wanted to keep there to confirm what was being entered. It might be something I keep going through other projects, but as a personal self relief and confirmation this made me feel better about what I entered was correct prior to going back to my list of games. Essentially, if a list becomes fairly large then I want to be able to edit prior to searching for it in my list.