dbussink (owner)

Revisions

  • a184ac dbussink Sun Nov 01 06:25:05 -0800 2009
gist: 223539 Download_button fork
public
Public Clone URL: git://gist.github.com/223539.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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