Partials and Rendering Partial Contents

Hi,

I have a complex bunch of divs and CSS that I’d like to tuck away into a
partial. Essentially it’s a box which nests something.

So my ideal situation would be if I could render the partial, and then
yield out so that my view can add some more content in the middle (again

  • this is a bunch of HTML that just creates a container for any block
    object).

In this way, I can reuse my partial whenever I need to visually contain
a block element.

I expected to be able to do this with partials, but after Googling I’m
not sure any more, I didn’t find anything very relevant.

Thanks for any advice!

Hi!

I don’t quite understand your problem, but I’m giving it a shot anyway
:slight_smile:
Somewhere in an erb template, you can call render :partial => ‘foo’
multiple times. If you want to provide different content to your
partial, you can supply local variables with :locals => {:foo => bar}.

Hope this helps.

// Wouter

Wouter de Bie wrote:

Hi!

I don’t quite understand your problem, but I’m giving it a shot anyway
:slight_smile:
Somewhere in an erb template, you can call render :partial => ‘foo’
multiple times. If you want to provide different content to your
partial, you can supply local variables with :locals => {:foo => bar}.

Hope this helps.

// Wouter

Sorry, I realise I wasn’t very clear. As often happens, minutes after
seeking help here I managed to find the answer:

Thanks!