Rails multitenancy story in 11 snippets of code

17-Oct-2020 1227
Let me tell you the story of how we implemented Postgres-schema based multitenancy in one of the projects we dealt with. It was an existing single tenant system — though definitions vary. We were meant to multitenantize this system. That was the main precondition that made us pick schema-based approach, but overall, the decision is not obvious. We also went for the Apartment gem, as it was the most mature and popular — but it’s not currently maintained, so we ended up on one of the forks.You can tell a story with a wall of text, but it’s not optimal for everyone. For example, children would rather see some pictures. When it comes to programmers, I guess a lot of you will prefer a snippet of code rather than a wall of text. So let me build the story around those.Please bear with the greek letters — I just wanted to use something more fun than plain digits :).
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle