Skip to content

Instantly share code, notes, and snippets.

@johnwahba
Created December 7, 2014 01:19
Show Gist options
  • Save johnwahba/12411559d01cff59168a to your computer and use it in GitHub Desktop.
Save johnwahba/12411559d01cff59168a to your computer and use it in GitHub Desktop.
<:Title>
New Poll
<:Body>
<h1>New Poll</h1>
<form>
<h3>Question</h3>
<input type="text" value="{{ page._todo._question }}">
{{ page._todo._answers.each do |answer| }}
<div><input type="text" value="{{ answer._text }}"></div>
{{ end }}
<div><button e-click="add_an_answer('')">Add an answer</button></div>
</form>
class PollsController < Volt::ModelController
def create_poll
end
def add_an_answer(answer)
page._todo._answers << {text: answer}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment