Rails/Validation
for validates_size_of
causes Unknown validator: 'SizeValidator'
error
#1270
Labels
bug
Something isn't working
The
Rails/Validation
rule forvalidates_size_of
tries to autocorrect the following to an unknown validator:validates_size_of :attribute, minimum: 1, if: :condition?, message: 'must have at least one'
Expected behavior
Produce
validates :attribute, length: { minimum: 1, if: :condition?, message: 'must have at least one' }
See also this doc
Actual behavior
Produces
validates :attribute, size: { minimum: 1, if: :condition?, message: 'must have at least one' }
, which causes an error:Steps to reproduce the problem
Autocorrect a
validates_size_of
withRails/Validation
RuboCop version
The text was updated successfully, but these errors were encountered: