Skip to content

Instantly share code, notes, and snippets.

@sickill
Created May 14, 2010
Embed
What would you like to do?
source 'http://gemcutter.org'
gem 'activesupport', '~> 3.0.0.beta3', :require => 'active_support'
gem 'dm-core', '~> 0.10.3', :git => 'git://github.com/datamapper/dm-core.git'
gem 'dm-types', '~> 0.10.3', :git => 'git://github.com/datamapper/dm-types.git'
gem 'dm-validations', '~> 0.10.3', :git => 'git://github.com/datamapper/dm-validations.git'
gem 'dm-migrations', '~> 0.10.3', :git => 'git://github.com/datamapper/dm-migrations.git'
gem 'dm-do-adapter', '~> 0.10.3', :git => 'git://github.com/datamapper/dm-do-adapter.git'
gem 'dm-mysql-adapter', :git => 'git://github.com/datamapper/dm-mysql-adapter.git'
gem 'data_objects', '~> 0.10.1'
gem 'do_mysql', :git => 'git://github.com/datamapper/do.git'
require 'rubygems'
require 'bundler'
Bundler.setup
Bundler.require :default
DataMapper.setup(:default, "mysql://localhost/test")
class A
include DataMapper::Resource
property :id, Serial
property :name, String
property :type, Discriminator
end
class B < A
property :color, String
end
DataMapper.auto_migrate!
A.create(:name => "Aaaa")
B.create(:name => "Bbbb", :color => "#123456")
A.all.each { |o| puts o.class; o.valid? } # boom for object of class B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment