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
3
votes
2 answers

Devise OmniAuth with a Multi-tenant Rails 5 App

Here is the situation. I have a multi-tenant rails app using the apartment gem where I need to implement a LinkedIn OmniAuth Strategy. As you can see by my routes, Devise users, and the associated routes, are only persisted on the individual schemas…
Will
  • 386
  • 2
  • 15
3
votes
1 answer

Rails 5 with Apartment - ArgumentError: prepare called on a closed database: rollback transaction

I've just added the Apartment gem to my existing project to make it a multi tenant application. after scaffolding a new model named Subdomain, with a single parameter 'title', for each user to enter his name and use the app independently of others,…
Jordan Shefner
  • 125
  • 1
  • 9
3
votes
3 answers

Rails Postgres Schema Issue - One of the following schema(s) is invalid: "test" "public"

I've searched high and low for an answer to this but I'm coming up short. I'm trying to build a multi-tenant application with Rails 4, Devise, and Apartment based on Postgres schemas. For my local Postgres server I decided to use PostgresApp. I…
3
votes
1 answer

I18n not loading translations with apartment gem rails

I am making a multi tenancy app using the apartment gem. I have it all set up and everything works as expected. I'm also using Rails Internationalization (I18n) with active record backend to store translations. My current setup Translation…
Joseph N.
  • 2,437
  • 1
  • 25
  • 31
3
votes
2 answers

Apartment active record query across tenants

I use Apartment for multi-tenancy. Is there any way that I can run a query across all tenants instead of just my current one? One kind of annoying way to do it would be something like tenants.map do | tenant | Apartment::Tenant.switch! tenant …
Xodarap
  • 11,581
  • 11
  • 56
  • 94
3
votes
1 answer

Active Admin and the Apartment Gem

I am new to Active Admin but from what I have seen so far I think this is quite easy to implement. I have an app with the apartment gem to add multi-tenancy. I am adding active admin to my app. Apartment uses PostgreSQL schemas to segregate data. …
Dan Tappin
  • 2,692
  • 3
  • 37
  • 77
3
votes
1 answer

Foreign key issues with Apartment gem

Getting the below error with associated (belongs_to) models: PG::ForeignKeyViolation: ERROR: insert or update on table "employees" violates foreign key constraint "fk_rails_0d62068e18" DETAIL: Key (contract_type_id)=(2) is not present in table…
Stephen Baidu
  • 31
  • 1
  • 4
3
votes
2 answers

How to force public schema for default schema Apartment Gem?

I am using the Apartment gem with Unicorn and Nginx. I am using the Subdomain elevator. In initializers/apartment/subdomain_exclusions I have Apartment::Elevators::Subdomain.excluded_subdomains = ['www'] My understanding is that the public schema…
riley
  • 2,387
  • 1
  • 25
  • 31
3
votes
1 answer

How to define seed file for Rails Apartment

I have set up the schema file but unable to define seed file for tenant such that it can run only for tenant migration only. Also I ma trying to create schema once a user has been created and its tenant is created. require…
user3226960
3
votes
1 answer

How can I use searchkick with pgSQL schemas/apartment and cycle through schemas?

I currently am trying to use searchkick within my multi-tenant Rails 4 app that uses Apartment and pgSQL schemas to handle the tenancy. However, I am unable to get searchkick to work. I am not exactly sure what I am doing wrong, but I am thinking…
3
votes
1 answer

Apartment gem migrations inside Rails Engine

I'm building a Rails Engine inside another rails app. The engine's rake tasks seem to get scoped to app: # inside /engines/engine_name $ rake -T apartment rake app:apartment:migrate # Migrate all tenants Whereas from the app's…
typeoneerror
  • 55,990
  • 32
  • 132
  • 223
2
votes
1 answer

Rails sunspot reindexing specific schema

I'm using rails-on-services/apartment this is a Multitenancy for Rails and ActiveRecord my setup is every time I create a Tenant the gem automatically creates a specific schema for the new tenant. every time I run the rails sunspot:reindex the…
wiwit
  • 73
  • 1
  • 7
  • 26
2
votes
5 answers

Rails: How to modify data using migrations due to change in the schema

I have following two migrations: One, Add column contextual_page_number to transcripts table: class AddContextualPageNumberToTranscripts < ActiveRecord::Migration[5.2] def change add_column :transcripts, :contextual_page_number, :integer,…
2
votes
1 answer

Cloning Mongoid document in ruby on rails from one tenant to another tenant

I am using ruby 2.7 and rails 6.0.3.2, mongoid gem 7.1.0 with ros-paartment gem 2.7.2. What I am trying to do? I have different tenants created using ros-apartment gem. I have populated data on admin tenant. In admin tenant, I have around 12 DB…
Bhagawat
  • 468
  • 4
  • 12
2
votes
1 answer

How can I switch redis host/pool in sidekiq?

I have multi-tenant rails application with apartment gem I can successfully switch database tenant in each worker using apartment-sidekiq. But sidekiq workers are using same redis server for all the tenant. I want to have complete isolation on redis…
Pramod Shinde
  • 1,802
  • 1
  • 15
  • 28
1 2
3
11 12