Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
Created September 10, 2009 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baroquebobcat/184741 to your computer and use it in GitHub Desktop.
Save baroquebobcat/184741 to your computer and use it in GitHub Desktop.
# Either datamapper or data objects has some weird behavior on jruby.
# When an empty text field comes before an integer field in a select,
# the integer field is clobbered.
require 'yaml'
require 'rubygems'
require 'dm-core'
class A
include DataMapper::Resource
property :id,Serial
property :txt,Text
end
DataMapper.setup :default,"mysql://root@localhost/testing"
DataMapper.auto_migrate!
A.create :txt=>'no clobbering time'
A.create
puts repository(:default).adapter.query('SELECT txt,id from `as`;').to_yaml
#from jruby
#---
#- !ruby/struct:#<Class:01x40395aaf>
# txt: no clobbering time
# id: 1
#- !ruby/struct:#<Class:01x40395aaf>
# txt:
# id: << ????
#MRI interpreter
#---
#- !ruby/struct:
# txt: !str:Extlib::ByteArray no clobbering time
# id: 1
#- !ruby/struct:
# txt:
# id: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment