Created
July 30, 2009 22:55
-
-
Save royw/158985 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
# demos a problem between ruby-gnome2-0.19.0 and datamapper-0.10.0 (also 0.9.11) | |
# basically if a datamapper model is used, then created Gtk::Window objects will | |
# be drawn empty (i.e., the windows are blank looking). | |
require 'rubygems' | |
gem 'dm-core', '=0.9.11' | |
#gem 'dm-core', '=0.10.0' | |
require "gtk2" | |
require 'dm-core' | |
require 'dm-yaml-adapter' | |
# DataMapper.setup(:default, 'sqlite3::memory') | |
DataMapper.setup(:default, {:adapter => 'yaml', :directory => 'db'}) | |
# window properly displays when USE_MODEL is false, | |
# the window is blank when USE_MODEL is true. | |
USE_MODEL = true | |
# USE_MODEL = false | |
if USE_MODEL | |
class Person | |
include DataMapper::Resource | |
property :id, Serial | |
property :name, String, :length => 80 | |
end | |
# Using the model is what triggers the error | |
DataMapper.auto_migrate! | |
# Person.auto_migrate! | |
# Person.auto_upgrade! | |
who = Person.create(:name => 'Roy') | |
puts Person.first.name | |
end | |
# Gtk.init | |
window = Gtk::Window.new | |
window.signal_connect('destroy') {Gtk.main_quit} | |
frame = Gtk::Frame.new('Content Frame') | |
frame.add Gtk::Label.new("Howdy") | |
window.add frame | |
window.show_all | |
Gtk.main | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment