lib/whyvalidationssuckin96/validation_support.rb in whyvalidationssuckin96-1.2.1 vs lib/whyvalidationssuckin96/validation_support.rb in whyvalidationssuckin96-1.2.2
- old
+ new
@@ -21,10 +21,11 @@
# Is this object valid?
# @return [true, false]
def valid?
all_validations.collect do |validation|
- validation.validates?
+ # Checks manually because a 'nil' return is considered a skipped validation, not a failed one.
+ (validation.validates? == false) ? false : true
end.all?
end
# An array of instances of failed validations
# @return [Array]
\ No newline at end of file