gberz3
2007-Sep-02 02:56 UTC
Associating (or scoping) information with currently logged in user/company. . .?
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
gberz3
2007-Sep-02 11:03 UTC
Re: Associating (or scoping) information with currently logged in user/company. . .?
Perhaps this is what I''m looking for?: http://elctech.com/content/scope-controller-model On Sep 1, 10:56 pm, gberz3 <gbe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---