mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-22 11:42:19 -05:00
This needs to be done because settings validators seems to pollute each other. I'll raise an issue for that, but in the meantime, this will do.
10 lines
287 B
Ruby
10 lines
287 B
Ruby
# frozen_string_literal: true
|
|
|
|
class RegexArrayValidator < ActiveModel::EachValidator
|
|
def validate_each(record, attribute, value)
|
|
return unless value.is_a? Array
|
|
return unless value.any? { |pattern| pattern.to_regexp.nil? }
|
|
record.errors.add(attribute, :invalid)
|
|
end
|
|
end
|