Skip to content

Instantly share code, notes, and snippets.

@emmapersky
Created November 29, 2010 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emmapersky/720257 to your computer and use it in GitHub Desktop.
Save emmapersky/720257 to your computer and use it in GitHub Desktop.
GDI Ruby Week 3, Layout
require 'rubygems'
require 'sinatra'
get '/' do
erb :index
end
post '/say_hello' do
@name = params[:name]
erb :form
end
__END__
@@ layout
<html>
<head>
<title>Say Hello!</title>
</head>
<body>
<%= yield %>
</body>
</html>
@@ index
<form method='post' action='/say_hello'>
<input type='text' name='name' />
<input type='submit' />
</form>
@@ form
<h1>Hello <%= @name %></h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment