Code autogenerating

I've seen in my code lots of repeating code connected with view(new/edit/
delete. I'd like to write an autogenerator of code (I'm going to base on
acts and scaffolding code).

Where in rails directory hierarchy should I put it?

Maciej Piechotka wrote:

I've seen in my code lots of repeating code connected with view(new/edit/
delete. I'd like to write an autogenerator of code (I'm going to base on
acts and scaffolding code).

Where in rails directory hierarchy should I put it?

The first line of defense is "Refactoring" (with unit tests) to "DRY" that code up, where DRY means "Don't Repeat Yourself".

Ruby is so good at folding abstractions together, you ought to work to get that repeating code down to a few single lines. If you then actually need to generate the code, the common classes that you extracted should fit perfectly inside it.

My Short Cut at O'Reilly has dozens of very effective techniques, including a few new assertions, to write unit tests for all kinds of View code, not just Ajax. The tests will make refactoring safe.