Many to one association question

21 views
Skip to first unread message

Jacob Basham

unread,
Apr 13, 2012, 1:18:10 PM4/13/12
to datam...@googlegroups.com
Howdy!

I have a very simple Many to One relationship

class InterviewGroup
  include DataMapper::Resource

  property :id, Serial
  has n, :interviews
end

class Interview
  include DataMapper::Resource

  property :id, Serial
  belongs_to :interview_group
  belongs_to :person
end

The problem is when I destroy an Interview, it deletes the parent InterviewGroup. Originally we had a :constraint => :destroy on InterviewGroup#interviews, removing the constraint still results in the InterviewGroup being destroyed. The odd thing is the related Person is not destroyed.

How would I go about fixing this so deleting an Interview will not destroy the Group?

Thanks!

Reply all
Reply to author
Forward
0 new messages