# Design question REST join table

**URL:** <https://www.ruby-forum.com/t/design-question-rest-join-table/133915>\
**Category:** Rails\
**Created:** [April 4, 2008, 10:15pm UTC](https://www.ruby-forum.com/t/design-question-rest-join-table/133915 "2008-04-04T22:15:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 4, 2008, 10:15pm UTC](https://www.ruby-forum.com/t/design-question-rest-join-table/133915/1 "2008-04-04T22:15:26Z")

</div>

Hello,

I’m currently designing a rails application using REST principles. I  
have an employee table, subservices table, and employees\_subservices  
join table. Should I create a resource called employee\_subservices or  
is there another design approach I can take?

Thanks,  
Ruben

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 4, 2008, 10:56pm UTC](https://www.ruby-forum.com/t/design-question-rest-join-table/133915/2 "2008-04-04T22:56:44Z")

</div>

removed\_email\_address@domain.invalid wrote:

> Hello,
> 
> I’m currently designing a rails application using REST principles. I  
> have an employee table, subservices table, and employees\_subservices  
> join table. Should I create a resource called employee\_subservices or  
> is there another design approach I can take?
> 
> Thanks,  
> Ruben

I think that would depend on whether you want a simple “has and belongs  
to many” where the join table (employee\_subservices) is little more than

employee\_id  
subservice\_id

or a fuller table with those IDs and some other information as well. If  
so, google “habtm with attributes” or something like that. I also track  
who and when on everything, so even my join tables are at a minimum

employee\_id  
subservice\_id  
created\_at  
created\_by  
updated\_at  
updated\_by

and I use whatever name makes sense to me. I have users, teams, and  
memberships (my join table)… not team\_users.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 5, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/design-question-rest-join-table/133915/3 "2008-04-05T17:51:34Z")

</div>

Thanks, I finally decided to go with a resource for my  
employees\_subservices table and all is working fine.

Ruben
