Here is a problem: while the user is adding , deleting and modifying data , data anomalies can arise, for example take the the two table A, B which are joined by the intermediate join table A_B:
[A] id:integer name:string
[A_B] a_id:integer b_id:integer
[B] id:integer name:string
Now I have in A's model file: has_many :a_b, :dependent => :destroy
and in B's model file : has_many :a_b, :dependent => :destroy
Apparently sometimes the dependent destroy directive is not taking place.
For example B is deleted from the database but the deleted record's id remains in A_B. This causes nil.nilclass exceptions ; what is the best way of handling this? [more explanation see 1]
How to gracefully tackle these data anomalies that may arise?
{1}Elaboration :
example [A] [1:TestA]
[A_B] [1,1]
[B] [1:TestB]