Skip to content

Instantly share code, notes, and snippets.

@postmodern
Created June 1, 2009 04:47
Show Gist options
  • Save postmodern/121233 to your computer and use it in GitHub Desktop.
Save postmodern/121233 to your computer and use it in GitHub Desktop.
Recreation of a DataMapper STI/auto_upgrade bug
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