All threads / Multi tenancy for one type of user

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Multi tenancy for one type of user

John Vehr asked in Rails

Chris

Would you ever see a scenerio where you would use a multi tenancy approach for one type of user? For example lets say you have an etsy like example, the vendor would have their own section vendorname.app.com sign in they can have their employees log in though that etc they can upload and manage their own inventory and make just their inventory public to normal users, also allowing for transactions etc
thanks so much

Honestly, the thing that scales best and is easiest to do for just about all "multitenancy" is to just build it at an application level. Use pundit to verify that someone trying to access the vendor section has permissions.

Multitenency is really more for when you absolutely can't have two customer's data in the same database. Think situations like you are dealing HIPAA or something like that where you are collecting very private data.

In most cases, you just want to scope queries and add permissions to separate out parts of your app to specific users. For example, the vendor section you're talking about. If a user is marked as a vendor, then when they visit the vendor area, they only see their products. And if you want to scope it by domain, lookup the domain and verify if the user has permission, if not redirect them to theirs.

Thanks Chris makes sense!

I have just launched my multitenancy app using Milia Gem which is fantastic and uses primary keys rather than subdomains

Very Interesting.. I might look into this gem for my future SaaS Platform. Thank you very much for suggesting this gem.

No worries at all, let me know if you have any questions with it :)

Join the discussion

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

Join 37,344+ 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.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.