relation = scope_relation(record, relation)
# BEGIN change from https://github.com/rails/rails/pull/39602
# relation = relation.merge(options[:conditions]) if options[:conditions]
if options[:conditions]
conditions = options[:conditions]
relation = if conditions.arity.zero?
relation.instance_exec(&conditions)
else
relation.instance_exec(record, &conditions)
end
end
# END change from https://github.com/rails/rails/pull/39602
raise "wrong number of arguments (given 0, expected 1)"
triggered by a validation like
see
a patch to the validator would look like