You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, I noticed that when using validates :field, uniqueness: true on a model with belongs_to_multitenant doesn't cause the validation query to be restricted to the tenant.
My goal was a tenant-scoped uniqueness, but one could argue that application wide uniqueness can be meaningful in multitenant applications as well. In that spirit, I don't think it is a bug, but a sentence like "Multitenant doesn't affect Rails built-in uniqueness validation; for tenant-scoped validation use validates :field, uniqueness: { scope: :tenant_id }" in the readme would be helpful.
The text was updated successfully, but these errors were encountered:
Today, I noticed that when using
validates :field, uniqueness: true
on a model withbelongs_to_multitenant
doesn't cause the validation query to be restricted to the tenant.My goal was a tenant-scoped uniqueness, but one could argue that application wide uniqueness can be meaningful in multitenant applications as well. In that spirit, I don't think it is a bug, but a sentence like "Multitenant doesn't affect Rails built-in uniqueness validation; for tenant-scoped validation use
validates :field, uniqueness: { scope: :tenant_id }
" in the readme would be helpful.The text was updated successfully, but these errors were encountered: