help with DRY captcha

Hi everyone-

I'm wondering if someone can give me some design help in implementing
a DRY captcha solution. Given that I have a captcha controller which
can generate a unique hash, and a corresponding correct answer, I'd
like to extend every form, and/or every CRUD operation with a

So, one approach I can think of off the top of my head is to add an
attr_accessor to each model that uses a captcha, and on edit, set it's
value to the unique hash. In the corresponding view, add a hidden
field with the hash, and a text input for the attr_accessor field.
Then, on submit/update, perhaps in the model (before create, etc),
look up the hash and see if the typed in answer matches.

Ok, so far, does this seem reasonable?

I'd like to go one step further, and simply add one line to each model
and one line to each form partial like


However, I have zero idea where to start writing my own plugin. Does
this sound like the way to go? If so, can someone give me some
pointers to reading materials and strategies to implement my own
extension (this is a milestone for me, as I'm at the point where I may
actually be able to write a plugin that someone else can use).

Thanks for any help,