lib/sequel/plugins/validation_helpers.rb in sequel-3.40.0 vs lib/sequel/plugins/validation_helpers.rb in sequel-3.41.0
- old
+ new
@@ -222,10 +222,12 @@
arr = Array(a)
next if opts[:only_if_modified] && !new? && !arr.any?{|x| changed_columns.include?(x)}
ds = if where
where.call(model.dataset, self, arr)
else
- model.where(arr.map{|x| [x, send(x)]})
+ vals = arr.map{|x| send(x)}
+ next unless vals.all?
+ model.where(arr.zip(vals))
end
ds = yield(ds) if block_given?
ds = ds.exclude(pk_hash) unless new?
errors.add(a, message) unless ds.count == 0
end