Views inheritance

benmanns edited this page Nov 29, 2012 · 7 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 three 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

NOTE: This project is marked as abandoned on the GitHub page (http://stillmaintained.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

Render Inheritable

Render Inheritable allows one to generally inherit or override single templates for controller hierarchies. If a template is not found in the current view folder, it is looked up in the parent controller's view folder. There are no other dependencies except for Rails 3.

Source: http://github.com/codez/render_inheritable

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.