gaustin (owner)

Fork Of

Revisions

gist: 223543 Download_button fork
public
Public Clone URL: git://gist.github.com/223543.git
Embed All Files: show embed
sinatra-forms.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Subject: Re: Newbie to Sinatra looking for example
# From: Ryan Tomayko <r@tomayko.com>
# To: sinatrarb@googlegroups.com
# Content-Type: text/plain; charset=UTF-8
#
# > Alright, so I'm pretty new to both Sinatra and web applications, and I
# > was wondering if someone could write up a quick example use of
# > Sinatra. Basically I want to see how Sinatra handles <form>s in one
# > view, and then shows the input on a different view.
# >
# > I hope that doesn't sound too confusing.
 
require 'sinatra'
 
get '/' do
  erb "<form method=POST><input name=mess></form>"
end
 
post '/' do
  erb "Hot <%= escape_html(params[:mess]) %>"
end
 
__END__
@@ layout
<!DOCTYPE html>
<html><%= yield %></html>
 
# tomayko.com/about