Just came up with a simple but useful Rails trick (though I’m likely not the first).
Say you have a long table with the same controls (buttons, pagination, whatever) both above and below it.
Doing the controls twice over is not DRY; using a helper or partial may be overkill if these controls are never reused other than these two times.
It’s commonly used to pass content such as a title or sidebar box from a template to a layout, but you can also use it within one and the same page.
1 2 3 4 5 6 7 8 9 10 11 12 13
Prettier in Haml, of course:
1 2 3 4 5 6 7 8 9 10
The effect is something like inline partials. Perfectly DRY without adding much complexity.