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
4
votes
1 answer

DynamoDB multi tenant - partition key

I have read in a blog that I could "make" a dynamodb table multi tenant using the tenant id as the partition key and for e.g. the sort key as the customer id. It's sounds good, but imagine that I have a big workload for a tenant id = X, so I am…
p.magalhaes
  • 7,595
  • 10
  • 53
  • 108
3
votes
1 answer

Rails 5 Using Devise and acts_as_tenant

I have an application that's using Devise to handle sign in/registration. I'm also using acts_as_tenant. I need to ensure a Tenant is set every time someone goes to register/sign in. For acts as tenant to work, the tenant must be set prior to…
justin henricks
  • 467
  • 3
  • 6
  • 17
3
votes
1 answer

Rails acts as tenant getting nil in model on Heroku

Im using gem 'acts_as_tenant' in a Rails 3 app. I set the tenant in the applications controller based on domain: set_current_tenant_by_subdomain(:tenant, :subdomain) I have code in the workorder model that needs to use the current_tenant: class…
Reddirt
  • 5,913
  • 9
  • 48
  • 126
3
votes
4 answers

Devise and ActsAsTenant not playing nicely together

I am using ActsAsTenant, and I keep getting the error below on any Devise route (i.e. any Devise controller). It seems that Devise tries to get the current_user or something to do with getting a User before the tenant has been set, so ActsAsTenant…
Lee
  • 8,354
  • 14
  • 55
  • 90
2
votes
3 answers

ActsAsTenant current_tenant + Capybara + RSpec testing

I am trying to create an integration test with Capybara/RSpec that has a valid current_user (using the Warden.test_mode! trick) and I have also created a valid current_tenant by doing this in the test: ActsAsTenant.current_tenant =…
Ceres
  • 53
  • 1
  • 4
2
votes
1 answer

How to build associated records before "tenant" class is saved with acts_as_tenant gem?

Example... I have a class called client which is my tenant model. I have associated records to save along with each new client that gets created. Let's call them tasks. I created an after_initialize callback inside of client that calls a method…
2
votes
2 answers

Testing acts_as_tenant with rspec

I have a multi-tenancy app using ascts_as_tenant. I am trying to write a spec that tests a scope. So I want to test the output of User.active. In general this works fine with code such as the following it "returns a correct active user" do …
1
vote
0 answers

Best way to use acts_as_tenant with blueprinter gem

I am loving using the blueprinter gem for my API, but i'm finding using it with the acts_as_tenant gem kinda cumbersome with associations. I have to pass in the account as options, which gets annoying when you have more than one association or…
Ashbury
  • 2,160
  • 3
  • 27
  • 52
1
vote
0 answers

Multitenancy (Acts as Tenant gem): How to delete a tenant?

I am using the Acts as Tenant gem for Rails and, if I understood it right when using the acts_as_tenant :tenant on models/course.rb, it automatically includes the relationships between models (i.e. belongs_to :tenant and has_many :courses). So, now…
1
vote
1 answer

Rails Devise NoMethodError in Users::RegistrationsController#create undefined method `each_with_index' for #

I have a little app where i have changed account to venue and am now hitting an issue on user create with venue attributes NoMethodError in Users::RegistrationsController#create undefined method `each_with_index' for…
Joe Bloggos
  • 889
  • 7
  • 24
1
vote
1 answer

Tweaking scoping rules as part of acts_as_tenant?

I have a rails model Thing that uses acts_as_tenant to tie it to a company. This works fine, and now users who are part of a company can only access the Things associated with their company. class Thing < ApplicationRecord …
Chris Farmer
  • 24,974
  • 34
  • 121
  • 164
1
vote
1 answer

Model with acts_as_tenant fails validation after Rails 5 update

rails 5.2.1 ruby 2.5.1 My Model class InputForm < ApplicationRecord acts_as_tenant(:tenant) end InputForm.validators…
praaveen V R
  • 1,259
  • 1
  • 11
  • 20
1
vote
1 answer

Rolify and acts_as_tenant with Single Signon (with some Devise & Pundit on the side) - can it be done?

I am going to try and make this work in my Rails app but I figured I would see if anyone knew of a gotcha that would stop me in the tracks. The basic premise is that I have the following models: Company - the tenants in acts_as_tenant User - unique…
Dan Tappin
  • 2,692
  • 3
  • 37
  • 77
1
vote
1 answer

multi-tenant rails app user-account relationship issue

My application main gems: rails 4.1.1, pg, acts_as_tenant, devise and activeadmin. Application description: saas multi-tenant app with subdomains (not using postgresql schemas). I have 2 models: Account and User with: account belongs_to :owner a…
Olivier Severyns
  • 253
  • 4
  • 15
1
vote
1 answer

Scoping Account model with acts_as_tenant?

I'm using acts_as_tenant keyed on subdomain, and would like the "tenant" to be able to make changes to his Account record (change his subdomain), but not see anyone elses entry. Adding an account_id column to Account with the same id as Account.id,…
Matt
  • 3,682
  • 1
  • 21
  • 27
1
2 3