Skip to content

Instantly share code, notes, and snippets.

@mathieuancelin
Created January 23, 2012 15:20
Show Gist options
  • Save mathieuancelin/1663684 to your computer and use it in GitHub Desktop.
Save mathieuancelin/1663684 to your computer and use it in GitHub Desktop.
public class Application extends Controller {
public static void index() {
List tasks = Task.find("order by id desc").fetch();
render(tasks);
}
public static void createTask(String title) {
Task task = new Task(title).save();
renderJSON(task);
}
public static void updateTask(Long id, boolean done) {
Task task = Task.findById(id);
task.done = done;
task.save();
renderJSON(task);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment