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

Uniqueness validation #14

Open
mingan opened this issue Jan 18, 2016 · 1 comment
Open

Uniqueness validation #14

mingan opened this issue Jan 18, 2016 · 1 comment

Comments

@mingan
Copy link
Contributor

mingan commented Jan 18, 2016

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.

@wireframe
Copy link
Owner

great idea, and if you have any thoughts on how to organize in the README, I'd gladly accept a pull request.

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