Possible Duplicate:
Rails - Help understanding how to use :dependent => :destroy
I have the following models:
User
Permission (user_id, group_id)
Group
Conversation (group_id)
ConversationParticipation (conversation_id)
What I want to do in my Permissions model is, when a permission is destory, delete all the related ConversationParticipations based on the group_id and user_id.
I tried this:
class Permission < ActiveRecord::Base
has_many :conversation_participations, :through => :group, :source => :conversations, :dependent => :destroy
But that doesn't seem to be cutting it just yet. Suggestions?
Thanks