I’m not sure how to design my database. This is the casus:
There are users who can make declarations. And there are users who are
coupled to the declaration. They are the ones who have to pay for the
declaration. So the first users did pay for something in a store.
Enters it in the system and add other users to the declaration. The
costs are splitted among the coupled users.
For example: user A bought a crate of Beer for €9. His roommates (B
and C) are going to drink too and the all decide to share the costs. A
enters the crate in the system and everyone has to pay €3.
This is an existing application but I’m going to remake it in Ruby. (A
part of) the current structure is like this:
Is it possible to have the user_id in the declarations table and in
the many_to_many table? And does get this? Do I have to make an
has_and_belongs_to_many declaration AND an belongs_to?Or just one?
Thanks in advance!