views:

24

answers:

1

Hi,

i have used some of association in my project model. Corresponding child record will be deleted through dependent :destroy, if i delete any parent record.I have implemented logical delete which means every table has 'active' column by default it is 'true'. every true record is valid all other records are invalid(deleted record). in my sample,if i destroy the record that will be set to 'false' in active column. similarly i want to set active as 'false' to parent record then corresponding child record set to be 'false'. can you please help me to do this by best way?

+1  A: 

Hi You may try to implement some of rails callbacks in your child model Which one depends on your code Maybe before_destroy or after_destroy or any other

Bohdan Pohorilets
Callback function is powerful!
VvDPzZ