# Simple tables question

**URL:** <https://www.ruby-forum.com/t/simple-tables-question/169307>\
**Category:** Rails\
**Created:** [June 2, 2009, 4:51am UTC](https://www.ruby-forum.com/t/simple-tables-question/169307 "2009-06-02T04:51:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oftenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b5ac83/32.png) [@oftenly](https://www.ruby-forum.com/u/oftenly)\
**Post date:** [June 2, 2009, 4:51am UTC](https://www.ruby-forum.com/t/simple-tables-question/169307/1 "2009-06-02T04:51:57Z")

</div>

Sorry for this rudimentary question… I’ve been following Pragprog’s  
rails book, and somehow I’m still missing something basic:

I need to make a table (class) where one of the columns’ (attributes’)  
type is an array of objects of another class. In other words, I need to  
know how to implement a phone-book list, where you can click on the name  
of the entry and be taken to that person’s, say, bank info.

Does anybody know of any guides that might walk me through this, or be  
able to give me a rough picture of what needs to be done so I can figure  
it out myself?

Thanks.

---

<div class="post-metadata">

**Author:** ![oftenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b5ac83/32.png) [@oftenly](https://www.ruby-forum.com/u/oftenly)\
**Post date:** [June 2, 2009, 5:20am UTC](https://www.ruby-forum.com/t/simple-tables-question/169307/2 "2009-06-02T05:20:02Z")

</div>

> Does anybody know of any guides that might walk me through this, or be  
> able to give me a rough picture of what needs to be done so I can  
> figure  
> it out myself?

I think you want two separate models… where one has many of the other.

That is…

class Contact \<\< AR…  
has\_many :phone\_numbers  
end

class PhoneNumber \<\< AR…  
belongs\_to :contact  
end

Your sql table “phone\_numbers” would then have a “contact\_id” field.

-philip
