-
-
Save sunfmin/36954 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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>=>[]}>> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment