One of the most perplexing things that I encountered at the very beginning of my Flatiron journey was version control. Git who? Repo what now? I was told to commit early and often, but what exactly was I committing to? It turns out that the concepts are easy to grasp, but the information was not centralized and I had to do a good bit of googling to find my way.
While working on my latest project, an app for keeping track of when to take care of your houseplants, I wanted to make sure that I built the app in such a way that the user could link to specific parts of the app, even a specific plant’s information card. Additionally, they should be able to reload the page while viewing a specific plant or care event, and continue to see that plant or event when the page is done reloading. Seems easy enough. It became a bit of a headache though, so let me walk you through my final solution.
Despite the profundity you may expect from a blog post with that title, I’m not here to spill any philosophical tea. What I’m really after is exploring this confounding error message that I kept seeing in the Chrome developers console throughout the development of my latest app:
I’ve just finished building my first Rails web application, a simple to-do app built for collaboration among friends. I faced a few interesting challenges along the way, but perhaps my favorite was when I decided to introduce a nested form. See, for the purposes of streamlining the relationships in this app, I wanted Projects and Users to only be related through Tasks. If a User has created a Task associated with a Project, that Project should then show up on their homepage. The problem arises, though, when a User creates a new Project that has no Tasks. So, to fix this, I made sure that new Projects were created with a new Task with the help of a nested form.
“You may be a puzzle, but I like the way the parts fit,” and I can’t think of a better sentiment for learning to build a web app using Sinatra (not the singer this time).