Miles,

I too struggled with that a while ago, this is how I solved it. (seems
to work)

class Post
  ....

 has n, :comments

 # v1
 before(:destroy) { comments.destroy! }

 # v2
 before :destroy do
   comments.destroy!
 end

 # v3
 before :destroy, :delete_related_comments

 protected

   def delete_related_comments
     comments.destroy!
   end

end

I'm sure it can be improved upon, but it's fairly neat.


On May 20, 12:13 am, MilesTogoe <[email protected]> wrote:
> does datamapper support the command:
> has n, :users, :dependent => destroy
>
> I'm getting error on dependent
--~--~---------~--~----~------------~-------~--~----~
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