New Discussion

Notifications

You’re not receiving notifications from this thread.

Disabling a tenant in a Multi-tenancy Saas app with apartment

3
Rails

Hey everyone, I was launching a multi-tenant app and want to know if there is a way through which we can disable a tenant if they cancel the subscription without deleting their data.
I can add this in the routes.rb file -

--
class SubdomainConstraint
def self.matches?(request)
subdomains = %w{ www admin homes }
request.subdomain.present? && !subdomains.include?(request.subdomain)
end
end
Rails.application.routes.draw do
constraints SubdomainConstraint do
resources :companies
end

But then is there another way to add more names in that constraint without having to deploy the code everytime.
Do you have suggestions?

I would just put a before_action on all the controllers that directs away if they aren't subscribed. Nice and simple.

Thanks a ton. Let me try and implement this.

It worked!

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.