hensei-api/app/helpers/validation_errors_serializer.rb

16 lines
No EOL
368 B
Ruby

class ValidationErrorsSerializer
attr_reader :record
def initialize(record)
@record = record
end
def serialize
record.errors.details.map do |field, details|
details.map do |error_details|
ValidationErrorSerializer.new(record, field, error_details).serialize
end
end.flatten
end
end