From: Robert Klemme Date: 2012-11-22T22:59:36+09:00 Subject: Re: Arrays with records as objects On Thu, Nov 22, 2012 at 1:52 PM, Steve Tucknott wrote: > My todo list has a list array. I want to load the list array with the > item objects and am using the << operator as: > > @list << item_rec > > This seems to work ok, and my array goes from 0 length to 1. But, I had > hoped then to access the record fields via 'list', ie: > list[0].action > but when I try to access the 'list[n].action' I seem to have nil in the > field(s),although looking at 'list' in total seems to show the data. > List is ([# action="1", name="hgafafgafgagaf">>]) With that structure you rather need to do list[0].item_rec.action don't you? Can you share the code of class TodoItem? > Is it because I have an array of 'objects' - ie 'list' now contains a > single element of class 'TodoItem'? If so, how do I access the > 'item_rec' sub object of 'list'? See above. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/