helpers/common_helpers.rb
# Take a Crossbeams::Response and present it as an error message.
# For a validation error, the errors are listed in the returned message.
#
# @param res [Crossbeams::Response] the response object.
# @return [String] the formatted message.
Take a Crossbeams::Response and present it as an error message.
For a validation error, the errors are listed in the returned message.
Take a Crossbeams :: Response and present it as an error message . For a validation error the errors are listed in the returned message .
def unwrap_failed_response(res)
    if res.errors.empty?
      CGI.escapeHTML(res.message)
    else
      "#{CGI.escapeHTML(res.message)} - #{res.errors.map { |fld, errs| p "#{fld} #{errs.map { |e| CGI.escapeHTML(e.to_s) }.join(', ')}" }.join('; ')}"
    end
  end
def unwrap_failed_response ( res ) if res . errors . empty? CGI . escapeHTML ( res . message ) else "#{CGI.escapeHTML(res.message)} - #{res.errors.map { |fld, errs| p "#{fld} #{errs.map { |e| CGI.escapeHTML(e.to_s) }.join(', ')}" }.join('; ')}" end end
Take a Crossbeams::Response and present it as an error message.
Take a Crossbeams :: Response and present it as an error message .
the formatted message.
the formatted message .
String
res
the response object.
the response object .