コード例 #1
0
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))
}
コード例 #2
0
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
	}
}