Skip to content

Instantly share code, notes, and snippets.

@dbussink
Created November 1, 2009 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbussink/223539 to your computer and use it in GitHub Desktop.
Save dbussink/223539 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -Ku
# encoding: utf-8
require 'rubygems'
require 'dm-core'
require 'pp'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite3:memory:')
class Customer
include DataMapper::Resource
property :id, Serial
property :name, String
property :age, Integer
has n, :orders
end
class Order
include DataMapper::Resource
property :id, Serial
property :reference_code, String
belongs_to :customer
end
DataMapper.auto_migrate!
pp Order.all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment