Skip to content

Instantly share code, notes, and snippets.

@dxg
Created Jun 8, 2010
Embed
What would you like to do?
DATAMAPPER = 'git://github.com/datamapper'
DM_VERSION = '~> 1.0.0.rc3'
DO_VERSION = '~> 0.10.3'
gem 'dm-sqlite-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-sqlite-adapter.git"
gem 'dm-validations', DM_VERSION, :git => "#{DATAMAPPER}/dm-validations"
gem 'dm-constraints', DM_VERSION, :git => "#{DATAMAPPER}/dm-constraints"
gem 'dm-aggregates', DM_VERSION, :git => "#{DATAMAPPER}/dm-aggregates"
gem 'dm-is-list', DM_VERSION, :git => "#{DATAMAPPER}/dm-is-list"
gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
gem 'dm-do-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-do-adapter"
gem 'dm-active_model', DM_VERSION, :git => "#{DATAMAPPER}/dm-active_model"
gem 'data_objects', DO_VERSION, :git => "#{DATAMAPPER}/do.git"
gem 'do_sqlite3', DO_VERSION, :git => "#{DATAMAPPER}/do.git"
require 'rubygems'
require 'bundler'
Bundler.setup
Bundler.require :default
DataMapper.setup(:default, 'sqlite3::memory:')
class Candy
include DataMapper::Resource
include DataMapper::Validate
property :id, Serial
property :name, String, :length => 1..20
is :list
end
Candy.auto_migrate!
c = Candy.new
if c.save
puts 'Saved'
else
# this gives: 'Position must not be blank'
puts 'Could not save because:'
puts ' ' + c.errors.full_messages.join("\n ")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment