Skip to content

Instantly share code, notes, and snippets.

@derekrockwell
Last active December 14, 2015 00:49
Show Gist options
  • Save derekrockwell/5002190 to your computer and use it in GitHub Desktop.
Save derekrockwell/5002190 to your computer and use it in GitHub Desktop.
simple example of a form without a model backend
<%= form_tag('/sample') do |f| %>
<div class="field">
<%= label_tag :var1 %><br />
<%= text_field_tag :var1 %>
</div>
<div class="field">
<%= label_tag :var2 %><br />
<%= text_field_tag :var2 %>
</div>
<div class="actions">
<%= submit_tag %>
</div>
<% end %>
post "/sample" => "sample#sample"
def sample
#note to be cautious about checking what
#kind of input is coming in
var1 = params[:var1]
var2 = params[:var2]
@var3 = var1 + var2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment