Passing an array of hash to a render partial gives nil


#1

It looks like there is a problem passing an array of hash to a partial
render via a collection.

I am trying to do the following:

<%= render :partial => “listshop”, :collection => @pca %>

and @pca has the following:

@pca = Array.new
@pca << Hash[“test” => “1”]
@pca << Hash[“test” => “2”]

and in _listshop.erb, I have the following:
<%= listshop[“test”] %>

I get an “You have a nil object when you didn’t expect it!” error. If
I pass a value instead of a hash it works fine and if I manually
iterate through the array it works fine as well.

Anybody knows why? Am I doing something wrong?

/Carl


#2

My bad,

<%= listshop[“test”] %> should be <%= test %>