Episodes
Daniel said over 2 years ago on Multitenancy :
Nice post... have being a while without “no one” taking/sharing  “simplified” approach to implement multitenancy.
I would like to ask ... what your opinion/recommendation to extend the possibility to a user interact with more than one company ? 

David Kimura PRO said over 2 years ago on Multitenancy :
In that particular scenario, I would extract the company_id from the user model and instead have a company_user model so that you could have a user belong to multiple companies. 

Daniel said over 2 years ago on Multitenancy :
In this sense ... extracting to a new model company_user ... what do you think :
1) user choosing the current-company-id “in use” and keep at user model 
Database - level
Or
2) user choosing the current-company-id “in-use” and keep at cookies
Session - level
Positives and negatives between this 2 scenarios ? There is another Alternative ?

David Kimura PRO said over 2 years ago on Multitenancy :
My first instinct is to go the cookie at the session level route. When the session is destroyed their current company is cleared. Since this functionality is switching and not really related to persistency, I would avoid storing it on the user model. However, that said, it may make sense to have a preferences model (or attribute on the user model) for "default company" which would allow the user to select what their preferred company is.

shawnpkdev said over 2 years ago on Multitenancy :
What  program are you using for the wireframes? It looks awesome. 

David Kimura PRO said over 2 years ago on Multitenancy :
It's the Microsoft Whiteboard on iOS. I screen captured that part on an iPad.  

shawnpkdev said over 2 years ago on Multitenancy :
I notice that you use the same Rails template for your videos. Is there somewhere we can access that template? I really like the clean look of it. 

David Kimura PRO said over 2 years ago on Multitenancy :
  Look under the app/assets/drifting_ruby.css. It is mainly taken from Bootstrap 4, but I only picked and chose a few most commonly used items as well as adding in a few of my own. The idea was to have as "fresh" of an application as possible so that it didn't interfere with the episode content. A lot of videos out there will use a template which has lots of preconfigured stuff and it makes it difficult to see what is episode content vs template content. So beyond the stylesheet, there isn't anything else.

Ryan Mindigo said over 2 years ago on Multitenancy :
  i have a SaaS app using multi-tenancy with Apartment Gem and subdomains. Right now each user (email address) can only be in one subdomain. Would you have any suggestions on how to allow users to belong to multiple subdomains? Much appreciated!

David Kimura PRO said over 2 years ago on Multitenancy :
  It would depend if they should be two users or a single user within the system and how switching tenants would work. That's more of an architectural decision that has to be made. If they should be two separate users with the same email, you would need to include some sort of indicator for which tenant they are signing in to (i.e. subdomain). 

If they will be a single user, then you will need a table with the user_ids and the tenant_ids. I'd also have something that would trigger their session being tied to a single tenant. So, they would have a current_tenant which has one tenant selected from their has_many :user_tenants (or something similar).

Login to Comment