Class: Salestation::Web::Responses::UnprocessableEntityFromSchemaErrors
- Inherits:
-
Object
- Object
- Salestation::Web::Responses::UnprocessableEntityFromSchemaErrors
- Defined in:
- lib/salestation/web/responses.rb
Class Method Summary collapse
Class Method Details
.create(errors:, hints:) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/salestation/web/responses.rb', line 49 def self.create(errors:, hints:) = errors .map { |field, | "'#{field}' #{error_messages.join(' and ')}" } .join(". ") = hints .select {|field, | .any? } .map { |field, | "'#{field}' #{hint_messages.join(' and ')}" } .join(". ") UnprocessableEntity.new(message: , debug_message: ) end |