# Many-to-many-to-many examples / tutorials / best practice

**URL:** <https://www.ruby-forum.com/t/many-to-many-to-many-examples-tutorials-best-practice/87442>\
**Category:** Rails\
**Created:** [March 2, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/many-to-many-to-many-examples-tutorials-best-practice/87442 "2007-03-02T17:38:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![macarthy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71c47a/32.png) [@macarthy](https://www.ruby-forum.com/u/macarthy)\
**Post date:** [March 2, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/many-to-many-to-many-examples-tutorials-best-practice/87442/1 "2007-03-02T17:38:50Z")

</div>

Has anyone got or seen a “many to many to many” example/ tutorial  
anywhere ?

E.g. a model to handle , teacher , room , period

So

teacherA is in room 1 at 11-12 oclock or  
teacherA and B is in room 2 at 12 - 1 oclock

I want to know what the best way to model this is ? And how to  
display things like

Room 1

- 11 -12 Teacher A
- 12 - 1 Teacher & teacher B  
ROom 2  
etc…

or

Teacher A  
11-12 Room1  
12 -1 room 2

etc…

Thanks

---

<div class="post-metadata">

**Author:** ![macarthy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71c47a/32.png) [@macarthy](https://www.ruby-forum.com/u/macarthy)\
**Post date:** [March 5, 2007, 10:30am UTC](https://www.ruby-forum.com/t/many-to-many-to-many-examples-tutorials-best-practice/87442/2 "2007-03-05T10:30:59Z")

</div>

On 2 Mar 2007, at 16:38, macarthy wrote:

> Has anyone got or seen a “many to many to many” example/ tutorial  
> anywhere ?

Have a look at Josh S.'s Many to Many Dance-Off. It’s not quite  
what you are after but it might help you out:

[http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off](http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off)

Also see his other articles on this kind of thing:

[http://blog.hasmanythrough.com/associations](http://blog.hasmanythrough.com/associations)

Regards,  
Andy S.
