Sha256: 2643133fa1238758dccd0116a7e1178c4c2ffa15d1c04605d53b1c5ec2778bce
Contents?: true
Size: 483 Bytes
Versions: 5
Compression:
Stored size: 483 Bytes
Contents
class IncludesCombinationsValidation < Validation def self.validate(params, field, name, value, record, errors) combinations = params['combinations'] combinations.each do |included_combination| return if included_combination.all? {|required| value.include?(required)} end errors[field.name] << new(combinations) end def describe combinations = params.collect(&:to_s).join(', ') "must contain one of these combinations: #{combinations}" end end
Version data entries
5 entries across 5 versions & 1 rubygems