don't raise validation error if the message is empty

This commit is contained in:
Alex Turchyn
2024-12-13 20:38:03 +02:00
committed by Pete Matsyburka
parent 15d06f4fb0
commit bb552d13d4
3 changed files with 34 additions and 2 deletions
+2 -1
View File
@@ -89,12 +89,13 @@ module Params
raise_error(message || "#{key} must be unique")
end
def in_path(params, path = [])
def in_path(params, path = [], skip_blank: false)
old_path = @current_path
@current_path = [old_path, *path].compact_blank.map(&:to_s).join('.')
param = params.dig(*path)
param = nil if skip_blank && param.blank?
yield params.dig(*path) if param