Written by Sean Behan on Sun Jun 17th 2012

While writing software it's common to leave comments for your future self. For instance, if you have written some code but realize that it should be refactored to be more efficient, you may place something along the lines of "TODO: change active record find method and replace w/ a custom sql select finder ". With rails, if you follow this convention, you can get a list of your annotations with a rake task.

rake notes:todo
which will print out the file where the the todo was found along with the line number and the comment...
app/controllers/application_controller.rb:
  * [  8] fix me
Rails defines several other annotation types for you
rake notes                                # Enumerate all annotations
rake notes:fixme                          # Enumerate all FIXME annotations
rake notes:optimize                       # Enumerate all OPTIMIZE annotations
rake notes:todo                           # Enumerate all TODO annotations
And you also may define your own
# SEAN: please rewrite this method to query only chunky bacon 
you may find all instances of "SEAN" by running
rake notes:custom ANNOTATION=SEAN

Tagged with..
#annotations #productivity #rake #tasks #todo #Ruby on Rails

Just finishing up brewing up some fresh ground comments...