Introduce permanent and customizable procedure url
This commit is contained in:
parent
b68b62b8f0
commit
e5002dbb11
27 changed files with 5164 additions and 49 deletions
16
app/validators/procedure_path_format_validator.rb
Normal file
16
app/validators/procedure_path_format_validator.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class ProcedurePathFormatValidator < ActiveModel::Validator
|
||||
|
||||
def path_regex
|
||||
/^[a-z0-9_]{3,30}$/
|
||||
end
|
||||
|
||||
def validate(record)
|
||||
return false if record.path.blank?
|
||||
record.errors[:path] << "Path invalide" unless path_regex.match(record.path)
|
||||
end
|
||||
|
||||
def validate_string(path)
|
||||
return false if path.blank?
|
||||
path_regex.match(path)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue