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 -- Posted via http://www.ruby-forum.com/.
On 06/03/06, Anthony Green <email@acgreen.co.uk> 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 <h3>Common parts</h3> File parent.rhtml <%= render :partial => ''common'' %> File child.rhtml <%= render :partial => ''common'' %> <p>Let''s add some new contents</p> -- ?ukasz Piestrzeniewicz http://ragnarson.blogspot.com
> Use partials, for example: > > File _common.rhtml > > <h3>Common parts</h3> > > File parent.rhtml > > <%= render :partial => ''common'' %> > > File child.rhtml > > <%= render :partial => ''common'' %> > <p>Let''s add some new contents</p>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 -- Posted via http://www.ruby-forum.com/.
> views/parent/_common.rhtml > > _tony<%= render_partial ''parent/common'', @user %> _T -- Posted via http://www.ruby-forum.com/.
Hi Anthony, On 06/03/06, Anthony Green <email@acgreen.co.uk> 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.rhtmlIt 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) -- ?ukasz Piestrzeniewicz http://ragnarson.blogspot.com