deleting all related tuples in all relevant tables

I am assuming that you also have the three classes that correspond to the tables set up with a has_many relationship...


  def Table_a < ActiveRecord::Base
   has_many :table_as, :dependent => :destroy
   has_many :table_us, dependent => :destroy

  def Table_b < ActiveRecord::Base
   belongs_to :table_a

  def Table_u < ActiveRecord::Base
   belongs_to :table_a

The :dependent => :destroy is all you need in order to be able to do...


...and have all Table_u and Table_c entries that reference the first entry in Table_a destroyed.

Have a look at the options here: ClassMethods.html#M000530