Maybe this is normal operation, but this doesn''t seem right to me. I have models: - account -- has many listshares -- has many lists ( through listshares ) - list -- has many listshares -- has many accounts ( through listshares ) - listshare --belongs to account --belongs to list I would have expected that if I perform the action list.destroy, then any records in listshares with the associated list_id would be deleted too.. but they are not. If they should be, my model is wrong somewhere. If not, I can stop pondering, and code the listshares tidyup manually. Thanks Keith --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You need another declaration in your listshares setup: has_many :listshares, :dependent => :destroy In the has many through join model, Listshare is a model in its own right and we''ll only be destroyed if you specify so in the relationship. Hope that helps, Steve --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Do you mean that the LIST model should contain has_many :listshares, :dependent => :destroy ? ( You said listshare) When I put that in the LIST model, it does remove listshare records if a list is deleted, but now I''m confused about something else of course! I don''t always want to delete a list.. sometimes I want to just remove the relationship between a list and an account - in sql terms to delete from listhshare where account_id = x and list_id = y. I can''t work out how to do that ( apart from using sql ) Thanks in advance Keith --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---