Multitenancy with Rails by Ryan Bigg
Author:Ryan Bigg [Bigg, Ryan]
Language: eng
Format: azw3
Published: 2015-08-07T16:00:00+00:00
By having this middleware located here, the things should be well on their way to being scoped. Let’s find out if they’re there by running the test again. When we do that, we’ll see the first test fails like this:
Failure/Error: visit main_app.things_url(:subdomain => account_b.subdomain) ActiveRecord::RecordNotFound: Couldn't find Subscribem::Account with id=<id>
This test is failing because it can’t find an account. That much is pretty obvious from the error message. But why can’t it find an account? For that answer, we must look deeper. This issue is actually caused by the schema switching stuff we have just implemented. The root of this problem is that the schema lookup path no longer contains the schema which contains the accounts: the public schema.
To fix that problem, we can exclude some models from Apartment’s scoping. We only need to exclude the Subscribem::Account model for now, but later on we’ll need to do the Subscribem::Member and Subscribem::User too, so let’s exclude both of these models now with these lines in a new file called config/initializers/apartment.rb:
Apartment.excluded_models = ["Subscribem::Account", "Subscribem::Member", "Subscribem::User"]
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12579)
Hello! Python by Anthony Briggs(9917)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9780)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8303)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7698)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7100)
Microservices with Go by Alexander Shuiskov(6869)
Practical Design Patterns for Java Developers by Miroslav Wengner(6783)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6725)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Angular Projects - Third Edition by Aristeidis Bampakos(6139)
The Art of Crafting User Stories by The Art of Crafting User Stories(5660)
NetSuite for Consultants - Second Edition by Peter Ries(5593)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5404)
Kotlin in Action by Dmitry Jemerov(5067)
