lib/grape/validations/validators/all_or_none.rb in grape-0.16.2 vs lib/grape/validations/validators/all_or_none.rb in grape-0.17.0

- old
+ new

@@ -3,18 +3,18 @@ require 'grape/validations/validators/multiple_params_base' class AllOrNoneOfValidator < MultipleParamsBase def validate!(params) super if scope_requires_params && only_subset_present - fail Grape::Exceptions::Validation, params: all_keys, message: message(:all_or_none) + raise Grape::Exceptions::Validation, params: all_keys, message: message(:all_or_none) end params end private def only_subset_present - scoped_params.any? { |resource_params| keys_in_common(resource_params).length > 0 && keys_in_common(resource_params).length < attrs.length } + scoped_params.any? { |resource_params| !keys_in_common(resource_params).empty? && keys_in_common(resource_params).length < attrs.length } end end end end