Skip to content

Commit

Permalink
uniqueness: don't use a private Rails API
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
alyssais authored and mcmire committed Jul 11, 2020
1 parent a4289e9 commit 47ca467
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -396,7 +396,7 @@ def description_for_case_sensitive_qualifier
end

def validations
model._validators[@attribute].select do |validator|
model.validators_on(@attribute).select do |validator|
validator.is_a?(::ActiveRecord::Validations::UniquenessValidator)
end
end
Expand Down

0 comments on commit 47ca467

Please sign in to comment.