Questions tagged [apartment-gem]

Database multi-tenancy for Rack (and Rails) applications

Apartment provides tools to help you deal with multiple tenants in your Rails application. It helps you to have certain data sequestered based on account or company, but still allow some data to exist in a common tenant.

Resources:

176 questions
1
vote
1 answer

Gitlab-CI and Apartment Gem

I'm experiencing a strange problem while trying to set up Gitlab CI on my Rails 5.1 project which uses apartment gem for multitennancy support. I've got docker-compose set up to build my containers and run tests. And they are passing on my local…
Almaron
  • 4,127
  • 6
  • 26
  • 48
1
vote
1 answer

Continuous Integration issue -- PG::UndefinedTable: ERROR: relation "users" does not exist

Test suite passes on local, but fails on Travis-CI. Here's a snippet from a build that failed: Failures: 1) account creation allows access of subdomain Failure/Error: @account.save ActiveRecord::StatementInvalid: …
1
vote
1 answer

Sequence not start with a initial number using aparment gem

I try start a sequence with initial number in tenants, but only public schema got this. Take a look at my migration: class CreateDisputes < ActiveRecord::Migration[5.0] def change create_table :disputes, id: :uuid do |t| ... …
Bruno Wego
  • 2,099
  • 3
  • 21
  • 38
1
vote
0 answers

Switching Tenants and logging in user via Doorkeeper

I am trying to make doorkeeper work with my multitenant application which runs on Apartment Gem. I am trying to figure out a way to load schema for doorkeeper gem to find and authenticate the user. Any suggestions on how to proceed?
Aniket Rao
  • 758
  • 7
  • 16
1
vote
1 answer

Why is apartment-sidekiq not finding the tenant?

Im using a rails multitenant app with sidekiq. I add it apartment-sidekiq so it runs the jobs in the background with redis. My problem is that when i run MyWorker on the rails c I get this error: WARN: Apartment::TenantNotFound: One of the…
Frank004
  • 228
  • 1
  • 2
  • 16
1
vote
0 answers

two sessions creating in rails devise with apartment gem

I am using Apartment gem for multi tenant and devise gem for authentication every thing looks good and working fine but sometimes problem occurs when I login then devise did not take me to backend and redirect to home page. Then I noticed in browser…
Qubaish Bhatti
  • 700
  • 5
  • 22
1
vote
0 answers

InvalidForeignKey Apartment Gem when creating records

I have excluded user model in apartment initializer file. config.excluded_models = %w{Franchise User Franchiser} I have a ternary model between project and user but when i add members it throughs beneath error. ActiveRecord::InvalidForeignKey…
Muaaz Rafi
  • 1,469
  • 2
  • 15
  • 23
1
vote
0 answers

structure for managing tenant accounts from an admin account

I'm trying to create an API for a multi tenancy web app using Rails 5. But i'm in trouble figuring out an application structure that would allow us to do this: we don't want to enable users to register themselves to obtain their organization's…
1
vote
1 answer

PG::UndefinedTable: ERROR: relation does not exist for Multitenant Rails App

I am working on a Multi-tenant Ruby on Rails App along with another developer. I pulled his branch and received new migration files. I ran rake db:migrate. I visit the index of that controller and I get the undefined error. After some research I…
1
vote
1 answer

rake assets:precompile without database connection and with dynamic routes

I'm trying to compile my assets for production, this is not done locally. I've got 2 constraints: I cannot connect to the database (for this step) I have a dynamic route that usually require to get info from the db (but it's not necessary for the…
coding addicted
  • 3,422
  • 2
  • 36
  • 47
1
vote
0 answers

Unusual DB situation -- must do pg_dump from Heroku schema-by-schema, any fast way to do this?

Our Rails app silos client data using the Apartment gem, which creates a schema for each tenant. We are on Postgres 9.4 on Heroku. Everything worked fine until we got to about 600 tenants, when suddenly our automatic pg backups stopped working. We…
niborg
  • 390
  • 4
  • 16
1
vote
3 answers

Rails: Multi-tenancy with Devise and Apartment gem

I'm creating a multi-tenant app using devise and apartment gems. I'm using postgresql database. I've created a few models. 'User' model is in global namespace and it is used for authentication by devise gem. There are some other models (e.g.…
Faisal Khurshid
  • 1,869
  • 3
  • 21
  • 27
1
vote
1 answer

Switching Apartment tenants in Active Admin

This is an extension of my previous post: Active Admin and the Apartment Gem I thought I had this working but I am stuck. I have a Company model in the public schema as the tenant model and Locations in individual tenants. Here is my Active Admin…
Dan Tappin
  • 2,692
  • 3
  • 37
  • 77
1
vote
1 answer

RSpec around() block behaves different from a before() + after()

I'm using the apartment gem to manage a multi-tenant Rails app. Side Note: If you're unfamiliar with the gem, switching apartments is simply switching the schema used on the Postgres DB back-end. You change apartment tenants with…
user2490003
  • 10,706
  • 17
  • 79
  • 155
1
vote
2 answers

rails Apartment gem having trouble with the generic elevator

I've just starting using apartment and I want to develop an elevator that works from a shared secret. However my initial tests have not been promising. Where I am at right now is that I have the following: app/middleware/static_elevator.rb require…
robertpostill
  • 3,820
  • 3
  • 29
  • 38