I was on a roll until I started customizing the look of what Rails created for me... I broke something. ########### NoMethodError ########### 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 -------------------------------- I''ve got a member page where I list the current member on the left with an "Add Member" section in the main body area. When I click "Add Member" I get the above message that references the code below. <ul> <% for member in @members %> <li> <%= link_to member.first_name + " " + member.last_name , { # link_to options :controller => ''members'', :action => ''edit'', :id => member } %> </li> <% end %> </ul> Thank you all for your help! I''m such a NOOB! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It would appear that I''m going about it the wrong way. I think I need to split the actions up into more than one page... any thoughts? On Jul 16, 1:50 pm, Kedron <kedrho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I was on a roll until I started customizing the look of what Rails > created for me... I broke something. > > ########### NoMethodError ########### > > 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 > > -------------------------------- > > I''ve got a member page where I list the current member on the left > with an "Add Member" section in the main body area. When I click "Add > Member" I get the above message that references the code below. > > <ul> > <% for member in @members %> > <li> > <%= link_to member.first_name + " " + member.last_name , { # link_to > options > :controller => ''members'', > :action => ''edit'', > :id => member > } %> > </li> > <% end %> > </ul> > > Thank you all for your help! I''m such a NOOB!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2007-Jul-16 19:40 UTC
Re: nil? I don''t know no nil... or maybe I do know nil...
Hi -- On Mon, 16 Jul 2007, Kedron wrote:> > It would appear that I''m going about it the wrong way. I think I need > to split the actions up into more than one page... any thoughts? > > On Jul 16, 1:50 pm, Kedron <kedrho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I was on a roll until I started customizing the look of what Rails >> created for me... I broke something. >> >> ########### NoMethodError ########### >> >> 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 >> >> -------------------------------- >> >> I''ve got a member page where I list the current member on the left >> with an "Add Member" section in the main body area. When I click "Add >> Member" I get the above message that references the code below. >> >> <ul> >> <% for member in @members %>''for'' is a wrapper around ''each'', so the problem is that @members is nil. I suspect that it''s something like this: when you add a member, you trigger an action that re-renders the page, after creating the new member, but does not set @members. That would account for the nilness. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.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 -~----------~----~----~----~------~----~------~--~---