Benedikt,

> > Can somebody tell me how I do :dependent => :destroy without dm-constraints?
>
> I don't think it will be very easy to do so, although there is some support 
> for pure-Ruby constraints in dm-constraints. Unfortunately, I do not recall 
> the details of how it works at the moment. Please have a look at the source 
> of dm-constraints for more details (it is not terribly large, although it is 
> a bit convoluted).

The important thing to remember about dm-constraints is that while it
does add foreign keys to the tables, they're only used as a "safety
net". The real logic happens inside the DM objects, where they will
issue destroy commands on each associated object when you
use :constraint => :destroy. This is required because :destroy needs
to work on a real object in case there are hooks that need to execute
after destruction.

Really, the only time the foreign keys come into play if something in
dm-constraints is broken, otherwise everything happens using the DM
objects. This means that dm-constraints works the same way with every
DataMapper adapter (aside from the safety net mentioned earlier).

--

Dan

-- 
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