Skip to content

Instantly share code, notes, and snippets.

@yohfee
Created December 22, 2010 07:08
Show Gist options
  • Save yohfee/751204 to your computer and use it in GitHub Desktop.
Save yohfee/751204 to your computer and use it in GitHub Desktop.
heroku_db_sample.rb
require 'bundler'
Bundler.setup
require 'sinatra'
require 'dm-core'
require 'dm-migrations'
get '/' do
Person.first.name
end
class Person
include DataMapper::Resource
property :id, Serial
property :name, String
end
DataMapper.setup(:default, ENV['DATABASE_URL'])
DataMapper.finalize
DataMapper.auto_migrate!
Person.create(:name => 'HOGE')
require './app'
run Sinatra::Application
source 'http://rubygems.org'
gem 'sinatra'
gem 'dm-core'
gem 'dm-postgres-adapter'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment