All threads / Global User for Multi-Tenancy with Local Tenant Users
Ask A Question


You’re not receiving notifications from this thread.

Global User for Multi-Tenancy with Local Tenant Users

Amie Fudge asked in Rails

I'm watching the rails tutorial on the apartment gem and am curious how to manage my Users, which I've already created through Devise and implemented User Roles.

Essentially, I want one Super User to have access to all tenants (that would be me). One Tenant User who logs in globally and gets switched to his/her tenant (this person would be my customer) and then all other Users to be within the Tenant subdomain. (i.e. staff and customers of the Tenant Owner). I want the Tenant Owner to manage their own users within their subdomain but not have access to any other users.

Do I have to create another User class? Devise is not my friend and I'd hate to muck around with that any more than I have to. Creating a parent without Devise would be the ideal way for me to go but I still want the Devise authenticaton that I've already implemented on the User class. Asking too much?

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 68,326+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.