lib/lotus/validations/errors.rb in lotus-validations-0.1.0 vs lib/lotus/validations/errors.rb in lotus-validations-0.2.0
- old
+ new
@@ -78,13 +78,11 @@
# @param expected [Object] the expected value
# @param actual [Object] the actual value
#
# @since 0.1.0
# @api private
- def add(attribute, validation, expected, actual)
- @errors[attribute].push(
- Error.new(attribute, validation, expected, actual)
- )
+ def add(attribute, *errors)
+ @errors[attribute].push(*errors) if errors.any?
end
# Return the errors for the given attribute
#
# @param attribute [Symbol] the name of the attribute