While writing code to show themes in Zammu, I had to show the same button in two places on the same page. The easy way is to duplicate the code. But that causes problems with maintainability.
e.g.
1 | <%= content_for :secondary_nav do %> |
To remove duplication I just used a content_for
and captured the code that had to be duplicated and used yield
to spit it out in the two places.
The changed code is:
1 |
|
Now if I have to change the button, I have to do it only in one place. Our code is DRY as a bone :)
I am currently working on LiveForm which makes
setting up contact forms on your website a breeze.