Skip to content

Instantly share code, notes, and snippets.

@rociopaez
Last active August 29, 2015 14:06
Show Gist options
  • Save rociopaez/6616d44ae2e7221ed1d8 to your computer and use it in GitHub Desktop.
Save rociopaez/6616d44ae2e7221ed1d8 to your computer and use it in GitHub Desktop.
class Outputs < Cuba
define do
on("new") do
render("outputs/new", title: "Output")
end
on post, param("output") do |params|
date = Date.new(params["date_year"].to_i, params["date_month"].to_i, params["date_day"].to_i)
output = Output.create(date: date, scale: params["scale"], duration: params["duration"], user: current_user)
res.redirect("/outputs")
end
on get do
render("outputs/index", title: "Outputs", outputs: current_user.outputs)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment