don't raise validation error if the message is empty
This commit is contained in:
committed by
Pete Matsyburka
parent
15d06f4fb0
commit
bb552d13d4
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user