Ruby on Rails Saturday, July 7, 2012

On 7 July 2012 19:26, Doug Jolley <lists@ruby-forum.com> wrote:
>> As it states the result is effectively an array of Order objects. So
>> to get the name of the first object one uses pos[0].name.
>
> I THINK you are confirming my suspicion. Clearly, the first object
> (which corresponds to the first table row) is pos[0]. From that I would
> deduce that pos[0].name is a getter method within the pos[0] object
> for accessing the name instance variable which apparently contains the
> value for the name column in the first object (which corresponds to the
> first row).
>
> From my point of view, the omission in the book is that the order object
> contains an instance variable for each column and that instance variable
> has the same name as the corresponding column. Additionally, the order
> object has accessor methods (or, at least a getter method; but, I
> suspect that there is also a setter method) for each of these instance
> variables.

I have not looked at that book recently but I would have expected that
to be covered rather early on. I am sure that if you turn over the
page you will find it.

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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.

No comments:

Post a Comment