Skip to content

Instantly share code, notes, and snippets.

@steveklabnik
Created February 27, 2012 20:01
Embed
What would you like to do?
hypermedia search
<!DOCTYPE html>
<html>
<head><title>SEARCH</title></head>
<body>
<form method="GET" action="/results">
<input type="text" name="q" />
<input type="submit" />
</form>
</body>
</html>
get "/results" do
results = Stuff.where(:something => params[:q])
results = results.collect do |result|
"<li>#{result.title}</li>"
end.join("\n")
OUT <<-
<!DOCTYPE html>
<html>
<head><title>SEARCH</title></head>
<body>
<ul>
#{results}
</ul>
</body>
</html>
OUT
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment