DRY in your views (RoR)

Excellent tutorial on how to DRY views in Ruby On Rails.

Developers tend to spend a lot of time refactoring their controllers and helpers, but once they get to the views (rhtml), more often than not, the DRY (Don’t Repeat Yourself) hat just disappears. This is not surprising, HTML markup by its very nature predisposes you to repetition of structural tags. However, in certain situations, a little Ruby magic can go a long way. Namely, you should get into the habit of creating block helpers to DRY up your views. Let’s take a look at the often (ab)used case of rounded corners.

…… follow the source to read more !


Leave a Reply

Your email address will not be published. Required fields are marked *