views:

35

answers:

2

Working with a large code base and I'm hesitant to run annotate on all models. Is it possible to use the Rails annotate plugin to just annotate one model at a time?

A: 

The plugin itself is really trivial, about 50 lines of code:
http://repo.pragprog.com/svn/Public/plugins/annotate_models/lib/annotate_models.rb

You can easily adjust do_annotations method to read input parameter (or, maybe, just hardcode your model name in there).

But no, I don't see model-selection functionality in there right now.

Nikita Rybak
+2  A: 

I'm looking at the annotate 2.0.0 source and the only options to the rake task are some basic switches. It does not accept any other arguments or switches. I would guess that you're out of luck for the old-fashioned way.

It's a really simple gem. You could always make the modification yourself and submit it back to the project. Open source has its advantages. =]

It's not hard to make a config/initializer monkeypatch that adds the functionality you want. That's a good compromise between forking and submitting a patch.
tadman