YAY! I failed my first code challenge!
It seems like everyone loves to speak about all of the success in our life. All of the good gets all the glory and we just shove the bad in the back of our minds, and pretend it doesn’t affect us. Truth be told the pressure kicks in. At least for me it did, I started to doubt if I was even capable of continuing this course or just be able to keep up in general. Instead of having this whole pity party for myself(which I’m great at btw) and all the reasons why failed. I decided to dust myself off and keep on pressing forward despite the difficulties that come my way. In this blog I will be going over some quick tips on my experience with Flatiron’s Mod 2 code challenge.
Using Rails Generators
We could manually input our models, controllers, view folders etc but that would take some time. We have built in rails generators so let’s use them! Not only do generators save time. But it also takes writing conventions off of our plates. Theirs plenty of rails generators, See the full list here! but my favorite is resource.
Resource generates the following:
Establishing your relationships
For this example I will be using a user, a comment and a post.
Draw out your relationships! it will be a lot easier to write and understand them: (the middle is the joiner)
post — < comment > — user
Understanding RESTful conventions:
- Index: Show all the posts
- Create: Create a new post
- New: Render the form for creating a new post
- Edit: Render the form for editing a post
- Show: Show a single post
- Update: Update a post
- Destroy: Delete a post
Conclusion
I hope this helped at least one person who may have to retake the code challenge. Taking an L is always hard but at the end of the day if you can walk away from this course knowing that you gave it your all, you will have no regrets. Remember Successful people are just a bunch of losers who never gave up.