Module: DrySerialization::Concerns::SerializationHelper

Defined in:
lib/dry_serialization/concerns/serialization_helper.rb

Instance Method Summary collapse

Instance Method Details

#error_response(errors, status = :unprocessable_entity) ⇒ Object



8
9
10
11
12
13
# File 'lib/dry_serialization/concerns/serialization_helper.rb', line 8

def error_response(errors, status = :unprocessable_entity)
  errors = [errors] unless errors.is_a?(Array)
  errors = handle_errors(errors)

  render json: { errors: errors }, status: status
end

#success_response(data = {}, status = :ok) ⇒ Object



4
5
6
# File 'lib/dry_serialization/concerns/serialization_helper.rb', line 4

def success_response(data = {}, status = :ok)
  render json: data, status: status
end