Are views inheritable

Is it possible to use a child model’s controller to impliment it’s
parents view before adding its own output ?

possibly by the use of super ?

_tony

On 06/03/06, Anthony G. [email protected] wrote:

Is it possible to use a child model’s controller to impliment it’s
parents view before adding its own output ?
possibly by the use of super ?

Use partials, for example:

File _common.rhtml

Common parts

File parent.rhtml

<%= render :partial => ‘common’ %>

File child.rhtml

<%= render :partial => ‘common’ %>

Let's add some new contents

Use partials, for example:

File _common.rhtml

Common parts

File parent.rhtml

<%= render :partial => ‘common’ %>

File child.rhtml

<%= render :partial => ‘common’ %>

Let's add some new contents

Doesn’t the partial have to be in the model named directory for that to
work ?
ie
views/child/_common.rhtml

whereas I want it to use

views/parent/_common.rhtml

_tony

views/parent/_common.rhtml

_tony

<%= render_partial ‘parent/common’, @user %>

_T

Hi Anthony,

On 06/03/06, Anthony G. [email protected] wrote:

Doesn’t the partial have to be in the model named directory for that to
work ?
ie
views/child/_common.rhtml

whereas I want it to use

views/parent/_common.rhtml

It may be anywhere, you just have to provide a proper path:

app/views/

  • parent/
  • _common.rhtml
  • list.rhtml (uses :partial => ‘common’ - local path)
  • child/
  • list.rhtml (uses :partial => ‘/parent/common’ - path from other
    controller)