Agile Web Development

Build it. Launch it. Love it.

Annotate models

Add a comment summarizing the current schema to the top of each ActiveRecord model source file.


License Ruby's
Rating (66 votes)
Owner Dave Thomas
Created 14 April 2006


  • Avatar
    Wes Gamble
    12 July 2006

    This plugin has a couple of issues.

    It can't handle abstract model classes. It can't handle models that descend from ActionMailer::Base.

    I was able to get past the abstract model issue but unable to cause the annotation to skip models that descend from ActionMailer::Base.

  • Kevin
    31 August 2006

    This plugin also updates the annotation for all models when a migration is run. Result is that you end up committing changes to model files that did not really change, except that the migration number incremented.

  • Amos
    23 February 2007

    Dave has done it again. I just need to figure out how to automate it when I create a model. I often forget to run ">rake annotate_models" I guess it is time to update my generate script.

  • Avatar
    4 May 2007

    How can I annotate a model with different name with his table??

  • Avatar
    Julian Guppy
    4 June 2007

    I cant download this at the moment it just times out, soes does anybody have a local gem or a different svn repository, I think it's a lovely little gem and I want to install it on my new machine and have no source... :( sad developer....

  • Avatar
    bill pratt
    8 August 2007

    This plugin will accept a model name as an argument and only annotate that model, but it really should take MODEL= as an arg instead since rake views that standalone model name as another task to run and pukes a bit (after successfully annotating that single model)

  • Avatar
    Will Green
    14 November 2007

    SVN repository url is incorrect. It should be:

  • Avatar
    22 November 2007

    I've updated this plugin at

    It now (a) doesn't truncate long SQL types like "DECIMAL (10, 2)", (b) omits annoying "Skipping X" messages, (c) displays all models annotated on a single line, not one line per model, for more concise output. I also recommend putting this as a dependency inside your "rake all" task (or whatever you run just before checking in) so that the changelist that made the migration change has all the annotation changes in it as well.

  • Avatar
    28 February 2008

    I've incorporated the change from Alex and converted the whole thing into a gem and sake task, for those interested. Check it out at

  • Avatar
    Ian Heggie
    29 December 2008

    I patched this so it doesn't update files where only the version number has changed.


Add a comment