lib/ocean/ocean_application_controller.rb
#
# Renders a HTTP 422 Unprocessable Entity response with a body enumerating
# each invalid Rails resource attribute and all their errors. This is usually
# done in response to detecting a resource is invalid during +POST+ (create) and
# +PUT/PATCH+ (update). E.g.:
#
#  {"name": ["must be specified"],
#   "email": ["must be specified", "must contain a @ character"]}
#
# The messages are intended for presentation to an end user.
#
# The keyword argument +except+, if present, must be a string, symbol or an
# array of strings or symbols and will suppress error information for the
# enumerated attributes of the same names. This is sometimes useful when internal
# attributes which never appear in external resource representations depend on
# user-provided data, such as password hashes and salts.
#
Renders a HTTP 422 Unprocessable Entity response with a body enumerating
each invalid Rails resource attribute and all their errors. This is usually
done in response to detecting a resource is invalid during +POST+ (create) and
+PUT/PATCH+ (update).



The messages are intended for presentation to an end user.

The keyword argument +except+, if present, must be a string, symbol or an
array of strings or symbols and will suppress error information for the
enumerated attributes of the same names. This is sometimes useful when internal
attributes which never appear in external resource representations depend on
user-provided data, such as password hashes and salts.
Renders a HTTP 422 Unprocessable Entity response with a body enumerating each invalid Rails resource attribute and all their errors . This is usually done in response to detecting a resource is invalid during + POST + ( create ) and + PUT / PATCH + ( update ) . The messages are intended for presentation to an end user . The keyword argument + except + if present must be a string symbol or an array of strings or symbols and will suppress error information for the enumerated attributes of the same names . This is sometimes useful when internal attributes which never appear in external resource representations depend on user - provided data such as password hashes and salts .
def render_validation_errors(r, except: [])
    except = [except] unless except.is_a?(Array)
    except = except.collect(&:to_sym)
    render json: r.errors.messages.except(*except), status: 422
  end
def render_validation_errors ( r , except : [ ] ) except = [ except ] unless except . is_a? ( Array ) except = except . collect ( & :to_sym ) render json : r . errors . messages . except ( * except ) , status : 422 end
Renders a HTTP 422 Unprocessable Entity response with a body enumerating
each invalid Rails resource attribute and all their errors.
Renders a HTTP 422 Unprocessable Entity response with a body enumerating each invalid Rails resource attribute and all their errors .
r
except