Skip to content

Instantly share code, notes, and snippets.

@sushant12
Created June 2, 2017 09:12
Show Gist options
  • Save sushant12/cfeb58684f61c6dc88b05d3aa5a80a51 to your computer and use it in GitHub Desktop.
Save sushant12/cfeb58684f61c6dc88b05d3aa5a80a51 to your computer and use it in GitHub Desktop.
updating the task
elsif(env[‘PATH_INFO’] ==’/update’ && env[‘REQUEST_METHOD’] == “POST”)
req = Rack::Request.new(env)
id = req.params[“id”]
task = req.params[“task”]
finish = 0
if(req.params.include? ‘finished’)
finish = 1
end
DB.execute(“UPDATE tasks set name = ‘#{task}’, finished = ‘#{finish}’ where rowid=’#{id}’”)
return [ 302, {‘Location’ =>”/”}, [] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment