Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created December 11, 2008 02: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 jugyo/34580 to your computer and use it in GitHub Desktop.
Save jugyo/34580 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'dm-core'
DataMapper.setup(:default, "sqlite3:///#{File.expand_path(File.dirname(__FILE__))}/test.db")
class User
include DataMapper::Resource
property :id, Integer, :serial => true
property :name, String, :nullable => false
has n, :items
end
class Item
include DataMapper::Resource
property :id, Integer, :serial => true
property :name, String, :nullable => false
belongs_to :user
end
DataMapper.auto_migrate!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment