Created
October 30, 2009 00:04
-
-
Save nesquena/221967 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
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 |
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
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 |
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
#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