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
# Trying to replicate http://datamapper.lighthouseapp.com/projects/20609-datamapper/tickets/470-memcaching-can-t-marshal-dm-objects#ticket-470-19 | |
require 'rubygems' | |
require 'dm-core' | |
require 'dm-migrations' | |
require 'dm-timestamps' | |
DataMapper::Logger.new($stdout, :debug) | |
DataMapper.setup(:default, 'postgres://localhost/test') # createdb test | |
class TestDm | |
include DataMapper::Resource | |
property :id, Serial | |
property :created_at, DateTime | |
property :created_on, Date | |
property :updated_at, DateTime | |
property :updated_on, Date | |
has n, :tests, :through => :testing | |
has n, :testing | |
end | |
class Testing | |
include DataMapper::Resource | |
belongs_to :test_dm, :key => true | |
belongs_to :test, :key => true | |
end | |
class Test | |
include DataMapper::Resource | |
property :id, Serial | |
has n, :testing | |
end | |
DataMapper.finalize | |
DataMapper.auto_migrate! | |
test = Test.create.tap do |t| | |
t.testing.create(:test => Test.create) | |
end | |
puts Marshal.load(Marshal.dump(test)).inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment