# Wrapping indiv renders when rendering collection

**URL:** <https://www.ruby-forum.com/t/wrapping-indiv-renders-when-rendering-collection/106358>\
**Category:** Rails\
**Created:** [June 8, 2007, 11:42pm UTC](https://www.ruby-forum.com/t/wrapping-indiv-renders-when-rendering-collection/106358 "2007-06-08T23:42:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [June 8, 2007, 11:42pm UTC](https://www.ruby-forum.com/t/wrapping-indiv-renders-when-rendering-collection/106358/1 "2007-06-08T23:42:28Z")

</div>

I’m new to Rails - still trying to figure out the cleanest place to  
put things.

I wrote my own in-place-editor that gives me a bit more support for  
things like lists. Works fine, but it requires that every item in the  
list be rendered wrapped in a with the item’s object id.

i’ve been using render :update :partial :collection, and putting the  
s explicitly in the partial view. but that’s ugly. it requires  
that whenever i reuse this mechanism, i have to know how it works.  
i’d rather be able to write the partial view without the and  
have it added in.

but how? i could use a layout, i suppose, in the render. but then i  
have to be sure the layout is there and named the right thing.

i tried things like render :update :collection :inline, to wrap the  
view, but that doesn’t work and seems ugly.

so - what’s the right idiomatic way to do this in Rails? suck it up  
and remember the layout file? create the layout file from the lib  
file that provides the in-list-editor capability? do something else?

opinions welcome. thx.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [June 11, 2007, 4:49pm UTC](https://www.ruby-forum.com/t/wrapping-indiv-renders-when-rendering-collection/106358/2 "2007-06-11T16:49:30Z")

</div>

On 6/8/07, Mike [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> that whenever i reuse this mechanism, i have to know how it works.  
> and remember the layout file? create the layout file from the lib  
> file that provides the in-list-editor capability? do something else?
> 
> opinions welcome. thx.

I think what you are asking is covered in this episode of rails cast.

> **[\#40 Blocks in View - RailsCasts](http://railscasts.com/episodes/40-blocks-in-view)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

–  
Edward Grant  
removed\_email\_address@domain.invalid
