app/controllers/eivo/concerns/rendering.rb in eivo-rails-api-0.0.7 vs app/controllers/eivo/concerns/rendering.rb in eivo-rails-api-0.0.8

- old
+ new

@@ -1,11 +1,10 @@ # frozen_string_literal: true module EIVO module Concerns module Rendering - extend ::ActiveSupport::Concern def render_success(serializer = nil) if serializer render json: serializer.serialized_json @@ -15,33 +14,33 @@ } render json: ::MultiJson.dump(data) end end - def render_unauthorized(exception = nil) + def render_unauthorized(_exception = nil) render_error 'unauthorized', status: :unauthorized end - def render_forbidden(exception = nil) + def render_forbidden(_exception = nil) render_error 'forbidden', status: :forbidden end - def render_not_found(exception = nil) + def render_not_found(_exception = nil) render_error 'not_found', status: :not_found end - def render_internal_server_error(exception) + def render_internal_server_error(_exception) render_error 'internal_server_error', status: :internal_server_error end def render_parameter_missing(exception) render_error 'parameter_missing', source: { parameter: exception.param } end def render_model_errors(errors) - json_errors = errors.details.map do |attribute, errors| - errors.map do |error| + json_errors = errors.details.map do |attribute, attribute_errors| + attribute_errors.map do |error| { code: error[:error], source: { parameter: attribute }, @@ -65,9 +64,8 @@ data = { errors: errors } render json: ::MultiJson.dump(data), status: status end - end end -end \ No newline at end of file +end