Hi All,
I’m currently developing a multi-user/multi-company invoice/billing
application in Rails. I haven’t implemented any kind of scoping
because I can’t figure out the most intelligent mechanism by which to
do it. I need to be able to associate all “Invoices”,
“Invoice_items”, “Clients”, “Products”, “Services” – well, you get
the idea – with the currently logged in “Company”. I fail to believe
that manually adding a “company_id” to every single table is the
best solution. Can you recommend any mechanism (or plugin) by which
to accomplish site-wide scoping?
Basically I need to do what so many others (e.g. Basecamp, Shopify,
etc) are already doing; simply with an invoicing/billing twist. I’m
not sure if they’re creating completely separate “installs” each time
a company is created, or if everything is being stored in a single DB
and being managed via associations. If the latter, are they tediously
adding “company_id” to “E-V-E-R-Y S-I-N-G-L-E A-S-S-O-C-I-A-T-E-D T-A-
B-L-E”?
Thanks,
Michael