Skip to content

Instantly share code, notes, and snippets.

@matthewlehner
Created July 27, 2012 01:59
Show Gist options
  • Save matthewlehner/3185769 to your computer and use it in GitHub Desktop.
Save matthewlehner/3185769 to your computer and use it in GitHub Desktop.
patient post help
post: ->
patientJSON = @toJSON()
patientJSON['responses'] = {}
for response in @responses().all()
patientJSON['responses'][response.question_id] = response.toJSON()['answer']
# looks weird, cause a Question has a 'question' attribute.
patientJSON['responses'][response.question_id]['question'] = response.question.question
$.post 'http://thenumbercreative.com/regurgitate_data', patientJSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment