# Partials and Rendering Partial Contents

**URL:** <https://www.ruby-forum.com/t/partials-and-rendering-partial-contents/177859>\
**Category:** Rails\
**Created:** [October 25, 2009, 6:13pm UTC](https://www.ruby-forum.com/t/partials-and-rendering-partial-contents/177859 "2009-10-25T18:13:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazcyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Post date:** [October 25, 2009, 6:13pm UTC](https://www.ruby-forum.com/t/partials-and-rendering-partial-contents/177859/1 "2009-10-25T18:13:18Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![jazcyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Post date:** [October 25, 2009, 6:17pm UTC](https://www.ruby-forum.com/t/partials-and-rendering-partial-contents/177859/2 "2009-10-25T18:17:48Z")

</div>

Hi!

I don’t quite understand your problem, but I’m giving it a shot anyway  
🙂  
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

---

<div class="post-metadata">

**Author:** ![jazcyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Post date:** [October 25, 2009, 6:42pm UTC](https://www.ruby-forum.com/t/partials-and-rendering-partial-contents/177859/3 "2009-10-25T18:42:31Z")

</div>

Wouter de Bie wrote:

> Hi!
> 
> I don’t quite understand your problem, but I’m giving it a shot anyway  
> 🙂  
> 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:

> **[Insight: Medical Device Software Articles and Resources](https://orthogonal.io/insights/)**
>
> Orthogonal provides timely news, literature reviews, articles, white papers, and commentary for a medical device manufacturing audience.

Thanks!
