Hi Jeremy,

I suspect this is SQL 101, but I will ask anyway.

I have the following models:

Item
  many_to_many :authors
  one_to_one :asset

Author
  many_to_many :items
  one_to_many :approvals

Asset
  many_to_one :item
  one_to_many :approvals

Approval
  many_to_one :asset
  many_to_one :author

An approval should be added/removed to any author added/removed to an item 
that has an asset. I am currently using after_add and after_remove hooks to 
achieve this. How can I push this relationship down to the database level, 
such that approvals are destroyed through cascade when authors are removed 
from items? I believe the ActiveRecord approach would be to use has many 
through. What do you recommend?

Best,

Jamie

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/G9WusN3uBgcJ.
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/sequel-talk?hl=en.

Reply via email to