lib/whyvalidationssuckin96/attribute_based_validation.rb in whyvalidationssuckin96-1.6.0 vs lib/whyvalidationssuckin96/attribute_based_validation.rb in whyvalidationssuckin96-1.6.1
- old
+ new
@@ -41,12 +41,15 @@
end
# Performs the validation, returning true or false if the validation passes or fails,
# or nil if the validation will not run.
# @return [true, false, nil]
+ #
+ # @todo - this method is uuuuuuuugly
def validates?
if options[:array]
return @passed = nil if skip_on_empty?
+ return @passed = false if !skip_on_empty? && Array(validatable.send(options[:attribute])).empty?
reset
@pos = 0
statuses = []
while validating?
status = super
\ No newline at end of file