-
-
Notifications
You must be signed in to change notification settings - Fork 909
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: don't use a private Rails API #995
Conversation
@@ -381,7 +381,7 @@ def description_for_case_sensitive_qualifier | |||
end | |||
|
|||
def validations | |||
model._validators[@attribute].select do |validator| | |||
model.validators_on(@attribute).select do |validator| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍, https://apidock.com/rails/ActiveModel/Validations/ClassMethods/validators_on does seem more appropriate.
Hey folks. In an effort to lighten our load as maintainers and be able to serve you better in the future, the shoulda-matchers team is working on cleaning out the cobwebs in this repo by pruning the backlog. As there are few of us, there are a lot of items that will simply never earn our attention in a reasonable time frame, and rather than giving you an empty promise, we think it makes more sense to focus on more recent issues. That means, unfortunately, that we must close this PR. Don't take this the wrong way: our aim is not to diminish the effort people have made or dismiss problems that have been raised. If you feel that we should reopen this PR, then please let us know so that we can reprioritize it. Thanks! |
Don't take this the wrong way: our aim is not to diminish the effort
people have made or dismiss problems that have been raised. If you
feel that we should reopen this PR, then please let us know so that we
can reprioritize it. Thanks!
This appears to still be relevant, and it's a trivial change, so I think
this PR should be reopened.
|
Ok! |
`ActiveRecord::Validations#_validations` is a private API. Fortunately, Rails provides an API that does exactly what's needed here, and it's been in Rails since at least 3.0.0, so let's use that instead.
I apologize it took me so long to merge this — this is in master now. |
ActiveRecord::Validations#_validations
is a private API.Fortunately, Rails provides an API that does exactly what's needed here, and it's been in Rails since at least 3.0.0, so let's use that instead.
I ran into an issue using shoulda-matchers with schema_validations. It overrides the public
ActiveModel::Validations
methods to dynamically add validations based on the database schema. Since shoulda-matchers accesses validations using a private API, it incorrectly causes test failures.