-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
I have activerecord-multi-tenant with following code in Gemfile.
so that I have to use it with Rails7.2
gem 'activerecord-multi-tenant', git: 'https://github.com/citusdata/activerecord-multi-tenant.git', ref: '0ac43aa98334a29ed3e5b33e0bcc5ee281f97254'
but in this version activerecord relation like following does not work propery.
class Hoge < ApplicationRecord
multi_tenant :tenant
belongs_to :fuga
belongs_to :tenant
end
class FishType < ApplicationRecord
multi_tenant :tenant
belongs_to :tenant
has_many :hoges
end
with these association, in MultiTenant.without scope, I got following result
[5] pry(main)> Hoge.first.fuga
Fuga Load (2.8ms) SELECT "fugas".* FROM "fugas" WHERE "fugas"."tenant_id" = 1 AND "fugas"."id" = $1 LIMIT $2 [["id", 10605], ["LIMIT", 1]]
=> nil
expected result i guess
[5] pry(main)> Hoge.first.fuga
SELECT "fugas".* FROM "fugas" WHERE "fugas"."id" = $1 LIMIT $2 [["id", 101], ["LIMIT", 1]
I would like to filter fugas without tenant_id clause.
In Rails6.1.7 and activerecord-multi-tenant(1.2.0), I can get expected result
How can I solve this problem?
Metadata
Metadata
Assignees
Labels
No labels