Skip to content

Instantly share code, notes, and snippets.

@xenda
Created October 11, 2011 05:23
Show Gist options
  • Save xenda/1277347 to your computer and use it in GitHub Desktop.
Save xenda/1277347 to your computer and use it in GitHub Desktop.
--view, assuming it's named "numbers/number.html.erb"
<%= form_tag "/somewhere" do %>
<%= text_field_tag "number %>
<%= submit_tag "Send" %>
<%= submit_tag "Send2" %>
<% end %>
<% if @result %>
<%= @result %>
<% end %>
--controller SomethingController
def somewhere
@result = params[:number]
case params[:submit]
when "Send" # do stuff
when "Send2" # do stuff
end
# do some stuff to @result
render "numbers/number.html.erb"
end
-- route
match "/somewhere" => "something#somewhere"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment