Skip to content

Instantly share code, notes, and snippets.

@nesquena
Created October 30, 2009 00:04
Show Gist options
  • Save nesquena/221967 to your computer and use it in GitHub Desktop.
Save nesquena/221967 to your computer and use it in GitHub Desktop.
class Application < Sinatra::Base
register SinatraMore::MarkupPlugin
register SinatraMore::RenderPlugin
configure :development do
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/db/app.db")
end
class User
include DataMapper::Resource
property :id, Serial
property :username, String, :nullable => false
property :email, String, :nullable => false
property :created_at, DateTime
end
configure :development do
DataMapper.auto_upgrade!
end
before do
headers "Content-Type" => "text/html; charset=utf-8"
end
get '/' do
@user = User.new
haml :index
end
end
require 'rubygems'
require 'sinatra/base'
require 'sinatra_more'
require 'dm-core'
require 'dm-validations'
require 'dm-timestamps'
require 'haml'
require 'application'
map '/' do
run Application
end
#index
- form_for @user, '/register' do |f|
= f.error_messages
= f.text_field_block :name
= f.text_field_block :email
= f.submit_block "Create"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment