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! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
(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 Jones <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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! > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Matt Jones mdj.acme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org President/Technical Director, Acme Art Company (acmeartco.org) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Well Matt Jones, 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 Jones 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 Jones <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> >> Thanks! >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> > > > -- > Matt Jones > mdj.acme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > President/Technical Director, Acme Art Company (acmeartco.org)-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---