Created
May 4, 2010 00:10
-
-
Save kblake/388771 to your computer and use it in GitHub Desktop.
sinatra starter file
This file contains hidden or 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' | |
require "sinatra/reloader" if development? | |
require 'dm-core' | |
DataMapper.setup( :default, "sqlite3://#{Dir.pwd}/my_app.db" ) | |
class Post | |
include DataMapper::Resource | |
property :id, Serial | |
property :title, String | |
end | |
DataMapper.auto_migrate! | |
get '/' do | |
Post.create(:title => "new post") #refresh and get new post, demonstration purposes only | |
@posts = Post.all | |
erb :index | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment