Rails Blog

Adventures in Ruby on Rails Programming

Monthly Archives: July 2016

Rake notes

By | Programming | No Comments

All good programmers understand the necessity of commenting their code.  Comments can save time and headache when coming back to a clever chunk of your own code a year later. Sometimes we need leave comments that are really notes to ourselves or our teammates, and it can become hard to tell the difference.  Wait, where did I leave those todo notes? Search for “todo”?  No way.

Rails gives us many tools, and rake notes is a helpful one.  When making comments that are really notes to yourself, start the line with one these:
# TODO
# FIXME
# OPTIMIZE

Then when you want to get a list of those comments, just run:
$ rake notes

And Viola! References with line numbers to all your notes. Now go clean some code!

Social Links