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

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