Design question REST join table

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

[email protected] 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.

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

Ruben

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs