970 Experience
9 Lessons Completed
0 Questions Solved


It worked!

Thanks a ton. Let me try and implement this.

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)
Rails.application.routes.draw do
constraints SubdomainConstraint do
resources :companies

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

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.