Module: Extension::Tasks::Converters::ValidationErrorConverter
- Defined in:
- lib/project_types/extension/tasks/converters/validation_error_converter.rb
Constant Summary collapse
- FIELD_FIELD =
"field"
- MESSAGE_FIELD =
"message"
Class Method Summary collapse
Class Method Details
.from_array(context, errors) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/project_types/extension/tasks/converters/validation_error_converter.rb', line 11 def self.from_array(context, errors) return [] if errors.nil? context.abort(context.("tasks.errors.parse_error")) unless errors.is_a?(Array) errors.map do |error| Models::ValidationError.new( field: error[FIELD_FIELD], message: error[MESSAGE_FIELD] ) end end |