Partial Inheritance

Hey,

Is it possible to inherit a partial ?
I have a controller main and a controller news both of the controllers
have the same layout, the main layout … in the layout i call a partial
but it has to work on the news and the main controller.

thnx in advance
DP

You can call another controller’s partial, you just need to provide a
‘qualified’ name to it, ie render :partial => ‘/foo/bar’ to render the
‘bar’ partial from the foo controller

Fred

Yes,

I do this.

Put the _the_partial.rhtml in app/view/layouts/

then

render :partial => ‘layouts/the_partial’

I do this so much that most of my partials now live in app/view/layouts/

-Dan

thnx :stuck_out_tongue: it worked…
but i think it would be cool if rails automatticly inherrits partials
and views
of his parent …

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs