or: How I learned to stop worrying and love letting code repeat itself

Recursion is one of those ideas that doesn’t come within a million miles of making sense until it does. It’s easy to point it out as something that either you do get or you don’t, and it’s true that the idea is more difficult than most you’ll come across in web development, but there are some ideas that apply to it’s use that will simply make it easier to understand.

The first and greatest truth about recursion is that it ALWAYS follows the same pattern. Though the implementation may vary, recursive functions are always laid out in the same way…

Why creating custom rake tasks will save your life one day

Rake is easily one of the most powerful tools in the Rails arsenal. Whether or not you spend a large amount of time using it, its actions sit at the root of several essential Rails functions, most notably ActiveRecord migrations and seeds.

To give a quick review of a rake command, a commonly used one is to generate the appropriate database structure when loading a new rails app using migrations:

rake db:migrate

All rake commands utilize this same basic form, which consists of:

  1. Invoking rake
  2. Defining the “namespace” (more on those in a little bit)
  3. Calling the specific rake command

Zachary Stayman

Former IUP SGA President, Stressed Student, Giants and Yankees fan, political operative in recovery.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store