now available

now available
Want fresh tech tips in your inbox?

TODO and Custom Annotations in Rails Applications


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...

  * [  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 w/ #annotations #productivity #rake #tasks #todoruby on rails

Apps I've Built

XPath Expression Editor
Practice and improve your XPath skills with XPath Editor
Click to buy on the App Store
Photo Location Changer
Easily change the location on your photos and videos
Click here for more info about the app
Photo Date Changer
Easily change the dates and times on your photos and videos
Click here for more info about the app
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app