Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'dm-core'
- DataMapper.setup(:default, 'sqlite3::memory:')
- class Dummy
- include DataMapper::Resource
- property :id, Serial
- property :name, String
- end
- Dummy.auto_migrate!
- d = Dummy.new
- d.name = 'Test'
- d.save
- # if I marshal here, it will work, but in most apps, you'll be retrieving existing records
- d = Dummy.get(1)
- Marshal.dump d
- Result:
- TypeError: no marshal_dump is defined for class Thread
- from (irb):22:in `dump'
- from (irb):22
- Thread is likely from @transactions in the repository:
- irb(main):024:0* d.repository
- => #<DataMapper::Repository:0x113def8 @name=:default, @identity_maps={Dummy=>#<DataMapper::IdentityMap:0x113c2c4 @second_level_cache=nil, @cache={[1]=>#<Dummy id=1 name="Test">}>}, @adapter=#<DataMapper::Adapters::Sqlite3Adapter:0x119f428 @field_naming_convention=DataMapper::NamingConventions::Field::Underscored, @sqlite_version="3.5.8", @resource_naming_convention=DataMapper::NamingConventions::Resource::UnderscoredAndPluralized, @name=:default, @uri=#<struct DataObjects::URI scheme="sqlite3", user=nil, password=nil, host=nil, port=nil, path=":memory:", query=nil, fragment=nil>, @transactions={#<Thread:0x35700 run>=>[]}>>
Add Comment
Please, Sign In to add comment