require 'sinatra' require 'haml' require 'less' require 'dm-core' require 'dm-timestamps' #config set :haml, :format => :html5 #app get '/' do haml :index end post '/' do @grito = Grito.first_or_create(:title => params[:title], :text => params[:text]) haml :index end get '/style.css' do less :style end not_found do haml :error end DataMapper.setup(:default, ENV['DATABASE_URL'] || 'mysql://root:root@localhost/grita') class Grito include DataMapper::Resource property :id, Serial property :title, String, :required => true property :text, Text, :required => true property :created_at, DateTime def geturl() self.id.to_s(36) end end