Skip to content

Instantly share code, notes, and snippets.

@lucassmagal
Created July 5, 2012 14:58
Show Gist options
  • Save lucassmagal/3054184 to your computer and use it in GitHub Desktop.
Save lucassmagal/3054184 to your computer and use it in GitHub Desktop.
Sinatra app example
require 'sinatra'
require 'haml'
get '/' do
haml :index
end
get '/:name' do |n|
@name = n
haml :index
end
source :rubygems
gem 'sinatra'
gem 'haml'
%h1= "Hello #{@name}!"
!!!
%html
%head
%title Hello World
%body
= yield
@phstc
Copy link

phstc commented Jul 10, 2012

O código abaixo funciona para mim. :bowtie:

require 'rubygems'
require 'sinatra'
require 'haml'

get '/' do
  haml :index
end

get '/:name' do |n|
  @name = n
  haml :index
end

__END__
@@layout
!!!
%html
  %head
    %title Hello World
  %body
    = yield

@@index
%h1= "Hello #{@name}!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment