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 committed Jan 20, 2017
1 parent 9416f68 commit 27c815a
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -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|
validator.is_a?(::ActiveRecord::Validations::UniquenessValidator)
end
end
Expand Down

0 comments on commit 27c815a

Please sign in to comment.