Disabling a tenant in a Multi-tenancy Saas app with apartment
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.