Created
February 1, 2012 21:27
-
-
Save carlhoerberg/1719570 to your computer and use it in GitHub Desktop.
Adding a hash to a DM collection makes two items
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
require 'dm-core' | |
DataMapper.setup(:default, 'in_memory::') | |
class A | |
include DataMapper::Resource | |
property :id, Serial | |
property :jada, String | |
has n, :bs | |
end | |
class B | |
include DataMapper::Resource | |
property :id, Serial | |
property :joda, String | |
end | |
DataMapper.finalize | |
a = A.create | |
a.bs << {:joda => 'test'} | |
a.save | |
p a.bs | |
#=> [#<B @id=1 @joda="test" @a_id=1>, #<B @id=1 @joda="test" @a_id=1>] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment