Forum: Ruby on Rails Quick question on has_many :thorugh

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Benjamin P. (Guest)
on 2006-05-11 23:04
I was reading the documentation on this today and was wondering more
about the has_many :though, :dependent=>:destroy options. I am curious
how deep the deletes goes. Does it stop with the intermediate table or
does it pass through to the final table?

For example:
database
Categories (name, id)
Listings (category_id,product_id)
Products (id, name)

Assume in my Category Class I have
has_many :products , :through=>:listing, :dependent:=>:destroy

Now if I delete a Category, does it just delete the lisitng or does it
delete both the listing and the product?

Ben
This topic is locked and can not be replied to.