Sha256: 3b2041db21532ebda2c05b73f2ee570f27949034eba9810e1bff7dcf8c5e34e0
Contents?: true
Size: 361 Bytes
Versions: 16
Compression:
Stored size: 361 Bytes
Contents
class PathValidator < ActiveModel::Validator def validate(record) if match?(record.path) record.errors[:path] << "is Reserved!" end end def match?(path) # See if the applying path matches any reserved_paths via a Regex Landable.configuration.reserved_paths.any? { |reserved| Regexp.new("^#{reserved}$", 'i').match(path) } end end
Version data entries
16 entries across 16 versions & 1 rubygems