Skip to content

Instantly share code, notes, and snippets.

@dsugden
Created April 29, 2012 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsugden/2553568 to your computer and use it in GitHub Desktop.
Save dsugden/2553568 to your computer and use it in GitHub Desktop.
Play! controller method for backbone.js JSON create
/**
* Service Backbone save();
* @param id
*/
public void create(){
JSONDeserializer<Athelete>reportDeserializer = new JSONDeserializer<Athelete>().use( null, Athelete.class );
String json = params.get("body");
Athelete athelete = reportDeserializer.deserialize(json);
athelete.save();
json = Serializers.atheleteSerializer.serialize(athelete);
renderJSON(json);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment