Method: RestfulController#render_json_response

Defined in:
lib/app/controllers/concerns/restful_controller.rb

#render_json_response(success = true, results = {}, status_code = :ok) ⇒ Object

Render a JSON response with the results and status passed in. The payload will include an SHA1 hash along with the response for validation.



11
12
13
14
15
16
17
# File 'lib/app/controllers/concerns/restful_controller.rb', line 11

def render_json_response(success = true, results = {}, status_code = :ok)
  results[:success] = success
  render status: status_code,
         json: { results: results,
                 md5: hash(unescape_unicode(results.to_json)) }.to_json,
         layout: false
end