Skip to content
josevalim edited this page Jan 25, 2011 · 10 revisions

Views inheritance

Sometimes just DRY the controllers is not enough, if you need to DRY up your views, a lot of the resources often share the same views, wouldn't it be nice to have view files DRY'ed too? You can!

In Rails 3.1, this will be a Rails feature, but if you need to use a previous version, there are currently two projects do just that:

Inherited Resources Views

Inherited Resources Views is an extremely easy to use plugin to DRY the views associated with your inherited resources controllers. It is library-agnostic (it only depends on Inherited Resources) and it supports generating both erb and haml templates.

Source: http://github.com/fredwu/inherited_resources_views

Inherited Views

Inherited Views is a thin addition to the Inherited Resources project adding default html views which can be later customized on a per controller basis or globally for your rails app. It depends on Inherited Resources, Formtastic and WillPaginate.

Source: http://github.com/gregbell/inherited_views

Clone this wiki locally