YAY! I failed my first code challenge!

Evelyn Hernandez
3 min readJan 26, 2021

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.

Since my column names are strings I don’t have to specify the data type! Ruby magic *ooo aaa*

Resource generates the following:

Full list of all added files using resource generator
migration with our column names and data types
Our model class that inherits from Application Record
Our controller that inherits from Application Controller
View directory, but no view files.
A Full resources call

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

Here are my 3 models and their relationships

Understanding RESTful conventions:

A diagram showing how the views, controller actions, route and HTTP verbs are all mapped together
  • 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.

--

--

Evelyn Hernandez

I’m a FrontEnd Dev that enjoys learning & failing. With every unknown adventure comes failure, but only those who dare to fail greatly can ever achieve greatly.