lib/sequel/plugins/validation_helpers.rb in sequel-5.4.0 vs lib/sequel/plugins/validation_helpers.rb in sequel-5.5.0
- old
+ new
@@ -250,10 +250,11 @@
from_values = opts[:from] == :values
where = opts[:where]
atts.each do |a|
arr = Array(a)
next if arr.any?{|x| errors.on(x)}
- next if opts.fetch(:only_if_modified, true) && !new? && !arr.any?{|x| changed_columns.include?(x)}
+ cc = changed_columns
+ next if opts.fetch(:only_if_modified, true) && !new? && !arr.any?{|x| cc.include?(x)}
ds = opts[:dataset] || model.dataset
ds = if where
where.call(ds, self, arr)
else
vals = arr.map{|x| from_values ? values[x] : get_column_value(x)}