Created
June 1, 2009 04:47
-
-
Save postmodern/121233 to your computer and use it in GitHub Desktop.
Recreation of a DataMapper STI/auto_upgrade bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'dm-core', '0.10.0' | |
require 'dm-core' | |
module ModelMixin | |
include DataMapper::Types | |
def self.included(base) | |
base.module_eval do | |
include DataMapper::Resource | |
include DataMapper::Migrations | |
property :type, Discriminator | |
end | |
end | |
end | |
class User | |
include ModelMixin | |
property :id, Serial | |
property :name, String | |
end | |
class Admin < User | |
property :level, Integer | |
end | |
DataMapper.setup(:default, 'sqlite3:test.db') | |
DataMapper.auto_upgrade! | |
unless ARGV[0] == 'stop' | |
system('ruby',File.expand_path(__FILE__),'stop') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment