If you just want to have column descriptions in your model file, [annotate_models](github.com/ctran/annotate_models) should suite you well. Annotator will help you if you want to also keep your own comments about these columns.
Ever wondered what the heck is that column used for?
In your Gemfile:
Then in app directory:
Let's say you have a Foo model:
# My Foo model, it's awesome class Foo < ActiveRecord::Base
Make sure your working tree is clean (it's suggested tu put annotations in separate commits so you can easily review changes done by annotator before commiting and you can always easily revert them all) and run:
Then it should become something like:
# My Foo model, it's awesome # Attributes: # * id [integer, primary, not null, limit=4] - primary key # * body [text] - TODO: document me # * created_at [datetime] - creation time # * title [string] - TODO: document me class Foo < ActiveRecord::Base
Now you can edit these TODOs and run it again, nothing happens. But when you add new column and run it again:
# My Foo model, it's awesome # Attributes: # * id [integer, primary, not null, limit=4] - primary key # * body [text] - there we store foo complicated body # * created_at [datetime] - creation time # * some_number [integer, limit=4] - TODO: document me # * title [string] class Foo < ActiveRecord::Base
Of course similar thing happens when you remove column or change it's type.
it recognizes it's own block by “Attributes:” and then punctation list
if you don't want it to update anything, put “Attributes(nodoc):” instead
for some fields like title above you can just skip description including dash sometimes name is just obvious enough
multiline comments are ok
generating initial descriptions it understands things like
belongs_to association columns
Contributions are very much welcome.
since name does not have “model” in it, we could possibly use “rake routes” to annotate controller actions, not sure if it's worth it
Kacper Cieśla @ Tech-Angels http://www.tech-angels.com/