Last active
August 29, 2015 14:06
-
-
Save rociopaez/6616d44ae2e7221ed1d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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