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

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?

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

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/

  • Danny