“The best revenge is massive success” - Frank Sinatra
I grew up listening to Sinatra with my grandparents, he had such a beautiful voice and was a really interesting person. I had to give an ode to him by my title, and the quote (that fits perfectly in to how I feel about the project!).
I have been out of the coding game for months; my life reached a hectic limit that resulted in me getting a second surgery on my foot. I’m now, after almost a year, able to walk. I have a new lease on life and I am motivated to get back into coding and hopefully (fingers crossed!) finish the program by July. With that being said, I picked up right where I left off a few months ago and that was pretty tough for me. However, I stuck by it and just chugged along and with the help of some friends I have been able to stay motivated!
And here we are, I am sick (the flu, day 5), but like the quote above suggests the best revenge is success. I poured all my energy into doing Battle Pets to create a successful app, to get revenge on the flu! It might sound silly, but these past 5 days I’ve really been thankful I had this project do, preventing me from sitting around and feeling as bad as I really do.
My last project was the CLI Gem, and that had to do with ranking video games. I wanted to continue the theme, since video games are near and dear to my heart. I hope one day to be working in the video game industry.
The app is called Battle Pets and it is the one stop shop, as I like to call it, for someone who collects battle pets to have them all neatly organized in one place. For those of you who are not familiar with Battle Pets, they are little creatures (some cute and some ugly!) that you collect while play World of Warcraft. You can have battles and collect them all like Pokemon. A lot of people are obsessed with this part of the game, I don’t battle but collect them all!
I began with creating my DB and creating two tables one for the user and one for the pets and thus having my model be that a user has_many: pets and a pet belongs_to :user. My brain works better with steps and from the previous labs and talking to friends I found that beginning there was my best bet. After migrating my data/tables and getting my models set up I created my controllers. Note: I used Corneal Template, as it was suggested to help me get the template down. It is very helpful! It has all the basic files and folders that you need. I have an application controller - the main one -, a pet’s controller, and a user controller. This is where I spent most of my time because up until this project I was really unsure about get and post routes. I fear when my assessment happens I will choke because I am nervous, but I promise you I understand the big picture. Throughout this whole process I was git commiting almost everything, even when I realized I had spelled something wrong, I fixed it and pushed it to github. I then created my views for the user and for the pets. I wanted to keep this as simple as possible because I find myself always trying to over complicate something when I don’t need to!
I ran into many, many issues while doing views and the controllers but from what I have heard that is totally normal. And to be honest, all these issues actually helped me understand what I was doing more. One issue I found was that my pets did not have a user id, which I needed. I ended up deleting all my data (in frustration) and added them back in thinking that would help but it did not! It was a simple fix, and one when I was told by the learn tech coach I felt so silly. With that being said, I had SO much frustration with the fact that one simple forward slash missing messes up the whole thing, for example. In this instance I had pets.id which was causing the nil value. Tyler, showed me, that I had created p as the variable and it should be p.id not pets.id. Once that was fixed, everything worked!
To summarize, my app is a CRUD app. You can create a pet, update a pet, or delete a pet. I’ve made it so that the user logged in ONLY sees what they have, rather than the whole database. There are flash messages as per the requirement when you create a pet, or if you try to log in and the information is incorrect.
All in all, I am SO ready to be done with this app.