Home How to delete all associated records of Specific record using loop? (not Using dependent)
Reply: 0

How to delete all associated records of Specific record using loop? (not Using dependent)

user533
1#
user533 Published in July 20, 2018, 1:10 am

How to delete all associated records of Specific record using a loop? like When I will delete one Specific Seller at that time their related record should be deleted. eg. when One Seller is deleted that time their Products, Customer, SellerMarketplace should be deleted.(Not Marketplace should be deleted.)

class Seller < ActiveRecord::Base
    has_many :products
    has_many :customers
    has_many :seller_marketplaces
    has_many :marketplaces through: :seller_marketplaces
end
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.334813 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO