Skip to content

Instantly share code, notes, and snippets.

@mericano1
Created November 17, 2011 10:11
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 mericano1/1372844 to your computer and use it in GitHub Desktop.
Save mericano1/1372844 to your computer and use it in GitHub Desktop.
public static void save(Long id /*, Shop shop*/) {
Shop byId = Shop.findById(id);
// set owner manually (dont edit from FE)
User user = User.find("byEmail", Security.connected()).first();
byId.owner = user;
Binder.bind(byId, "shop", request.params);
// Validate
validation.valid(byId);
if (validation.hasErrors())
render("@form", byId);
byId.save();
index();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment