Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiTenant.without does not work for a polymorphic relationship #217

Open
kapso opened this issue Oct 26, 2023 · 1 comment
Open

MultiTenant.without does not work for a polymorphic relationship #217

kapso opened this issue Oct 26, 2023 · 1 comment
Assignees

Comments

@kapso
Copy link

kapso commented Oct 26, 2023

In the following code.

👍 the Visit.find_by query does not add account_id where condition, which is perfect
👎 but, during visit.save!, Rails does a Product lookup, to which an account_id where condition is added

MultiTenant.without do
  visit = Visit.find_by(visitable_type: "Product", visitable_id: 1)
  visit.last_visit_at = Time.current
  visit.save!
end

class Visit < ApplicationRecord
  multi_tenant :account
  belongs_to :visitable, polymorphic: true
end

class Product < ApplicationRecord
  multi_tenant :account
end
@kapso
Copy link
Author

kapso commented Jan 9, 2024

Hey guys, any clue, when this fix will be released?

Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants