Questions tagged [acts-as-tenant]

Multi-tenancy for Rails in a shared database setup.

Multi-tenancy for Rails in a shared database setup.

https://github.com/ErwinM/acts_as_tenant

37 questions
1
vote
2 answers

Rails 3 - acts_as_tenant with custom tenant ID column

Has anyone successfully used the Rails acts_as_tenant gem for multitenancy, where the tenant ID column is not named xxx_id? my model is something like has_one :tenant, :foreign_key => "tenant_code" acts_as_tenant :tenant Then I get my query…
wrschneider
  • 17,913
  • 16
  • 96
  • 176
0
votes
1 answer

Devise: subdomain redirect after login

I am using Devise and ActsAsTenant for a multi-tenant saas rails 7 app and am having trouble redirecting users to the correct subdomain after login with Device. Each User is associated with an Account that has a subdomain column. I have read through…
nalgenes
  • 320
  • 1
  • 2
  • 12
0
votes
1 answer

Acts_as_tenant, cached data for different tenants?

I made a user with two accounts, a user should have documents that are scoped to the account they belong to. I'm writing tests that @user.documents should be different if they are under @account_1 vs @account_2 ActsAsTenant.with_tenant(@account_1)…
Ashbury
  • 2,160
  • 3
  • 27
  • 52
0
votes
1 answer

How to configure acts_as_tenant gem with ActionCable in rails7

I'm working on a project with I use ActionCable, at the moment I'm learning about acts_as_tenant gem. I implement it in the project, but my WebSockets don't work. If I'm logged in subdomain1, and send data by the ActionCable on subdomain2, I receive…
0
votes
1 answer

Citus "create_distributed_table" giving "PG::UndefinedColumn"

When trying to create a distributed table with Citus, it gives a PG::UndefinedColumn: ERROR: column "x" does not exist I have enabled Citus on workers and main DB: SELECT run_command_on_workers($cmd$ CREATE EXTENSION citus; $cmd$); I created a…
heldopslippers
  • 828
  • 2
  • 9
  • 20
0
votes
1 answer

Set Multi Tenant in Active Admin Controllers (required for Searchkick index)

I am using Active Admin in my multi tenant app. I also use Searchkick which has a custom tenant specific index in each model: class Budget < ApplicationRecord multi_tenant :company searchkick inheritance: true,index_name: -> {…
Dan Tappin
  • 2,692
  • 3
  • 37
  • 77
0
votes
1 answer

What is the proper way of merging multiple postgres schemas into a single schema preserving the foreign key relationships?

We have a SAAS platform written in Rails using the postgres' schema based multitenancy and Apartment gem. The different schemas are identical, with same number of tables and same columns in each table. We want to migrate to foreign key based…
0
votes
0 answers

activerecord-multi-tenant / acts_as_tenant and Active Admin

Anyone managed to get this to work with ActiveAdmin? It seems that with AA you can only access the records that your normal user was last logged in under (i.e. AR is still scoping the DB calls with the last tenant). I know there is the…
0
votes
1 answer

Rails: Devise and acts_as_tenant registration process

I am using acts_as_tenant gem to manage a multi-tenant platform while using devise to manage users. A User in our system acts_as_tenant and belongs_to Organization. Organization acts_as_tenant and has_many Users. We are having trouble understanding…
justin henricks
  • 467
  • 3
  • 6
  • 17
0
votes
1 answer

Separate log file for each tenant

We are building a tenant based web app using acts_as_tenant gem. Since we are running same app for all the tenants so we have only one log file in whole system. This is causing problem when we need to analyze log of a particular tenant, Currently we…
Haider Ali
  • 800
  • 2
  • 9
  • 22
0
votes
1 answer

ActsAsTenant with tenantable nested attributes causes ActsAsTenant::Errors::NoTenantSet: ActsAsTenant::Errors::NoTenantSet

I'm working on the admin page for an application with a model called DealerBranch and a tenanted nested association called Address. I have a controller that looks like this for creating a new dealer branch: class Admin::DealerBranchesController <…
Winston Kotzan
  • 1,979
  • 20
  • 25
0
votes
1 answer

Sunspot search - ignore default scope

I'm using acts_as_tenant gem that injects default scope in my models. I also use Sunspot for search like so: Article.search do with(:organization_id, ActsAsTenant.current_tenant.id) fulltext params[:search] end Article model is scoped so that…
Lukasz Muzyka
  • 2,783
  • 1
  • 30
  • 41
0
votes
1 answer

Rails Devise how to set confirmation_url if using Tenants

I have a Rails app using Devise and it also uses acts_as_tenant. In my applications controller I create a variable for the url (including the tenant prefix). It's called $request_url The issue is that the URL in the confirmation email doesn't change…
Reddirt
  • 5,913
  • 9
  • 48
  • 126
0
votes
1 answer

acts_as_tenant gem is creating errors using RSpec/FactoryGirl

I am attempting to use the acts_as_tenant gem to scope SQL queries for multiple organizations. RSpec/FactoryGirl are pulling some dirty tricks, however. A bit of background: in my app, User and Grant both belong to an Organization. Only admin users…
ulysses_rex
  • 330
  • 3
  • 16
0
votes
2 answers

acts as tenant gem scopes all users data, ignoring scoping data based on the subdomain

I am using acts_as_tenant gem to do a multi-tenant app. I followed the instructions. I am using sub-domains. In my application_controller.rb I have: set_current_tenant_by_subdomain(:account, :subdomain) I am using Account as the tenant. In my User…
kalibbala
  • 498
  • 6
  • 12