public
Last active

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#!/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'
require "gtk2"
require 'dm-core'
 
DataMapper.setup(:default, 'sqlite3::memory')
 
# 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
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.