func (c OptionController) CreatePost(obj models.Option) revel.Result { revel.TRACE.Printf("POST >> option.create create ... (%v)", obj) obj.Validate(c.Validation) if c.Validation.HasErrors() { c.Validation.Keep() c.FlashParams() return c.Redirect(OptionController.Create) } c.Begin() if err := c.Txn.Insert(&obj); err != nil { c.Rollback() c.Flash.Error(err.Error()) return c.Redirect(routes.OptionController.Index()) } c.Commit() c.Flash.Success("option (%d) create succeed.", obj.ID) return c.Redirect(routes.OptionController.Index()) }