Help making a collection available in a view

I confess to being a newbie.

Here is the controller code, and I know there to be product_types that
are related to the photographer.

def list
photographer = Photographer.find_by_id( session[:photographer_id] )
@productTypes = photographer.product_types
end

And in the view…
<% for product_type in @product_types %>

Gives me error:
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each

Any thoughts?

Thanks!

(very odd replying to a message with the same name…)
Shouldn’t the second part be:

<% for product in @productTypes %>

to match the variable set in the controller?

–mdj

On 1/30/07, Matt J. [email protected] wrote:

Thanks!


Posted via http://www.ruby-forum.com/.


Matt J.
[email protected]
President/Technical Director, Acme Art Company (acmeartco.org)

Well Matt J., nice to meet you. I’m sure you, like me, have met many
people in your life who share our great (and very common) name.

And thanks for catching my silly typo!

Peace,

Matt

Matt J. wrote:

(very odd replying to a message with the same name…)
Shouldn’t the second part be:

<% for product in @productTypes %>

to match the variable set in the controller?

–mdj

On 1/30/07, Matt J. [email protected] wrote:

Thanks!


Posted via http://www.ruby-forum.com/.


Matt J.
[email protected]
President/Technical Director, Acme Art Company (acmeartco.org)