Skip to content

Instantly share code, notes, and snippets.

@martenlienen
Created July 30, 2014 10:40
Show Gist options
  • Save martenlienen/286c433f6d293c6c0ced to your computer and use it in GitHub Desktop.
Save martenlienen/286c433f6d293c6c0ced to your computer and use it in GitHub Desktop.
x = X.find(params[:id])
patch = Hana::Patch.new(JSON.parse(request.body.read))
json = JSON.parse(HAL::Writers::XWriter.new(x).to_json)
patched = patch.apply(json)
HAL::Writers::XWriter.new(x).from_json(patched.to_json)
x.save
render json: HAL::Writers::XWriter.new(x).to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment