# Cannot call render :partial :collection with an Array of Hash?

**URL:** <https://www.ruby-forum.com/t/cannot-call-render-partial-collection-with-an-array-of-hash/132417>\
**Category:** Rails\
**Created:** [March 19, 2008, 11:32pm UTC](https://www.ruby-forum.com/t/cannot-call-render-partial-collection-with-an-array-of-hash/132417 "2008-03-19T23:32:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [March 19, 2008, 11:32pm UTC](https://www.ruby-forum.com/t/cannot-call-render-partial-collection-with-an-array-of-hash/132417/1 "2008-03-19T23:32:35Z")

</div>

I tried calling something like this in my view:

\<%= render :partial =\> ‘foo’, :collection =\> [{1=\>2}, 3] %\>

And the partial doesn’t seem to be getting the first Hash object in  
the array.

Anyone else experienced this?

---

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [March 20, 2008, 9:18am UTC](https://www.ruby-forum.com/t/cannot-call-render-partial-collection-with-an-array-of-hash/132417/2 "2008-03-20T09:18:11Z")

</div>

On 19 Mar 2008, at 22:31, Eric wrote:

> I tried calling something like this in my view:
> 
> \<%= render :partial =\> ‘foo’, :collection =\> [{1=\>2}, 3] %\>
> 
> And the partial doesn’t seem to be getting the first Hash object in  
> the array.

There’s this note in partials.rb which may or may not explain this:

# NOTE: Due to backwards compatibility concerns, the collection

can’t be one of hashes. Normally you’d also just keep domain objects,

# like Active Records, in there.

Fred

---

<div class="post-metadata">

**Author:** ![eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@eric](https://www.ruby-forum.com/u/eric)\
**Post date:** [March 20, 2008, 1:08pm UTC](https://www.ruby-forum.com/t/cannot-call-render-partial-collection-with-an-array-of-hash/132417/3 "2008-03-20T13:08:12Z")

</div>

> And the partial doesn’t seem to be getting the first Hash object in  
> the array.

This seems relevant:

[http://blog.hypsometry.com/archives/2007/10/26/rendering\_a\_collection\_of\_things/](http://blog.hypsometry.com/archives/2007/10/26/rendering_a_collection_of_things/)

- Danny
