MikesTogue, > oh found the problem - in our User class we had: > > has n, :contacts, :dependent => :destroy > > took out the destroy option and things work fine
Right. Since the :dependent option is not a "reserved" option in DM, it thinks you want to scope the query by the option. like The #all finder, any non-reserved options passed to a relationship become part of the default scope. BTW if you use dm-constraints, you could use: has n, :contacts, :constraint => :destroy This will setup both in-software constraints that remove the contacts when the User is removed, but if your datastore has support, true foreign keys constraints will be created when you auto-migrate. While the in-software constraints are normally what is triggered, we add the true FKs as a safety-net for data-integrity, as well as for documentation purposes. Also IMHO given a long enough timeline most databases become integration databases, so having the constraints at the DB level provides more protection than keeping them purely at the software level. -- Dan (dkubb) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamapper@googlegroups.com To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---