Created
January 27, 2010 05:42
-
-
Save ocean/287566 to your computer and use it in GitHub Desktop.
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
# sweet bro. | |
%w(rubygems sinatra haml sass dm-core dm-timestamps).each {|gem| require gem} | |
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/dev.db") | |
DataMapper.auto_upgrade! | |
get '/' do | |
haml :index | |
end | |
post '/' do | |
@customer = Customer.new(:email => params[:email]) | |
@thanks = @customer.save | |
haml :index | |
end | |
class Customer | |
include DataMapper::Resource | |
property :id, Integer, :serial => true | |
property :email, Text, :nullable => false | |
property :created_at, DateTime | |
property :updated_at, DateTime | |
end | |
__END__ | |
@@ index | |
!!! | |
%html | |
%head | |
%title Hello | |
%body | |
%h1 Intro... | |
- if @thanks | |
%p oh hey thanks | |
- else | |
%p yeah we're not live yet, let's do the thing where you leave your email: | |
%form{:method => 'post'} | |
%input{:name => 'email'} | |
%button{:type => 'submit'} Send |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment