Hi,

require 'rubygems'
require 'dm-core'
DataMapper.setup(:default, 'sqlite3::memory:')

class Foo
  include DataMapper::Resource
  property :id, Serial
  property :name, String

  has n, :bars
end

class Bar
  include DataMapper::Resource
  property :id, Serial
  property :name, String

  belongs_to :foo
end

DataMapper.auto_migrate!

@foo = Foo.new(:name => 'baz')
@foo.bars = [Bar.new(:name => 'lala'), {:name => 'diudiu'}]

puts @foo.save

@foo = Foo.first
@foo.bars = [Bar.new(:name => 'test'), {:name => '123'}]

puts @foo.save

=>
true
false

How is this meant to work?

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to