Skip to content

Instantly share code, notes, and snippets.

@MarkMT
Created December 29, 2009 02:57
Show Gist options
  • Save MarkMT/265117 to your computer and use it in GitHub Desktop.
Save MarkMT/265117 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -Ku
require 'rubygems'
require 'dm-core'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'mysql://localhost/testdb')
class Host
include DataMapper::Resource
property :id, Serial
property :name, String
has 1, :event
end
class Event
include DataMapper::Resource
Extlib::Inflection.plural_word 'regatta', 'regattas'
property :id, Serial
property :name, Text
belongs_to :host
end
DataMapper.auto_migrate!
# Create a new user
p Event.new(:name => 'test').save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment