Created
November 29, 2010 17:28
-
-
Save emmapersky/720257 to your computer and use it in GitHub Desktop.
GDI Ruby Week 3, Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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