func CreateController(w http.ResponseWriter, r *http.Request) { r.ParseForm() j := job.Job{ Name: r.PostForm.Get("job[name]"), UserId: helpers.CurrentUser(r).Id, } d := make(map[string]interface{}) if j.Save() { d["job"] = j } w.Write(util.JSON(d)) }
func updateAttributes(j *job.Job, r *http.Request) { // TODO this needs to be changed. Not a good place to put this. if name := r.PostForm.Get("job[name]"); name != "" { j.Name = name } }