mirror of
https://github.com/docusealco/docuseal
synced 2026-11-05 22:52:32 -05:00
validate the uniqueness of submitter roles
This commit is contained in:
1 parent
3ebaacbb7a
commit
6f90147a11
3 files changed
+37
No files matched your search
@@ -65,6 +65,15 @@ module Params
|
||||
raise_error(message || "#{key} must follow the #{regexp.source} format")
|
||||
end
|
||||
|
||||
def unique(params, key, message: nil)
|
||||
return unless params.is_a?(Array)
|
||||
return if params.none?
|
||||
return if params.all? { |p| p[key].blank? }
|
||||
return if params.pluck(key).uniq.size == params.pluck(key).size
|
||||
|
||||
raise_error(message || "#{key} must be unique")
|
||||
end
|
||||
|
||||
def in_path(params, path = [])
|
||||
old_path = @current_path
|
||||
|
||||
|
||||
Reference in new issue
Block a user