I have the following scenario.
Three tables - Companies, Users and Submissions.
Starting with Companies. Each company has many users. Each user can
have one or more submissions (of articles related to a company). Hence
each submission needs to be linked to a company. Up to this stage, I
could probably use :through to link submissions to Companies. So far
But the complication comes in as such: Each user can make a submission
related not only to the company he belongs to but also to other
companies available on record. In which case the :through option may
not work any more in this scenario, I think.
I have been thinking about this for days and due to my limited
knowledge of relationships, I couldn’t come up with a feasible
solution. So far I came up with the following relationships:
class Company < ActiveRecord::Base
class User < ActiveRecord::Base
class Submission < ActiveRecord::Base
I have a suspicion that this setup will not work. The more I think
about it, the more confused I become. If someone could help with some
inputs/advice as how to go about this, it will be greatly appreciated.
Thanks in advance.