app/validators/path_validator.rb in landable-1.13.1 vs app/validators/path_validator.rb in landable-1.13.2
- old
+ new
@@ -1,9 +1,7 @@
class PathValidator < ActiveModel::Validator
def validate(record)
- if match?(record.path)
- record.errors[:path] << "is Reserved!"
- end
+ record.errors[:path] << 'is Reserved!' if match?(record.path)
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) }