Colin Law wrote: > To achieve this I use the syntax > > <%= render :partial => 'cart', :locals => {:mycart = @cart} %> >
I think that is supposed to be: <%= render :partial => 'cart', :locals => {:mycart => @cart} %> > Then use the variable mycart in the partial > and that produces the same error: ------------- NoMethodError in Store#index Showing app/views/store/_cart.html.erb where line #1 raised: 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 Extracted source (around line #1): 1: <% for num in mycart -%> 2: <div><%= num %></div> 3: <% end %> Trace of template inclusion: app/views/layouts/store.html.erb RAILS_ROOT: /Users/autie/2testing/dir1/rails/store2 --------------- By the way, my file views/store/add_to_cart.html.erb is blank, although I don't think that matters since the layout does not yield. -- 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---