2009/8/20 spokra <[email protected]>: > > in application controller > > @upcomingevents = Event.all > > in application layout > > <% @upcomingevents.each do |upcomingevent| %> > <%= upcomingevent.name %> > <% end %> > > > there are events.. but i get an error of > > > ActionView::TemplateError (undefined method `each' for nil:NilClass) > on line #77 of app/views/layouts/application.html.erb: > 74: <%= content_tag :p, msg, :class => key, :id => key -%> > 75: <% end -%> > 76: > 77: <% @upcomingevents.each do |upcomingevent| %> > 78: <%= upcomingevent %> > 79: <% end %> > 80: <div id="content" class="content">
In this sort of situation where one cannot see the cause of the problem by inspection I use ruby-debug to break into the controller and the view to check the value of variables. This usually gives useful clues. Colin --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

