Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Fix uniqueness validation to correctly work with STI#64

Closed
rykov wants to merge 1 commit into
datamapper:release-1.2from
gemfury:release-1.2
Closed

Fix uniqueness validation to correctly work with STI#64
rykov wants to merge 1 commit into
datamapper:release-1.2from
gemfury:release-1.2

Conversation

@rykov

@rykov rykov commented Jul 16, 2013

Copy link
Copy Markdown

Currently, uniqueness validation check is done by calling resource.model.first, which only scopes the query to that particular class. This patch uses property.model instead to scope the query to the class in which the property was defined and its children.

This is the best solution that I could find. There is no easy way to scope the query to the class which calls validates_uniqueness_of, only the class that defines the property.

@jordanyee

Copy link
Copy Markdown

@rykov Thanks for the fix. I've just run into this issue (and wrote some tests too). Is there anything I can do to help this pull request along?

@hamzakc

hamzakc commented Dec 10, 2013

Copy link
Copy Markdown

+1, I have just run into this bug as well.

@tillsc

tillsc commented Dec 30, 2014

Copy link
Copy Markdown
Contributor

I fixed that problem (a bit different) for the current master (1.3.0.beta) in #72 . After merging my pull request this pull request can AFAICS be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants