class Alumni < ActiveRecord::Base
	has_one :AlumniStatus
	has_one :AlumniData
	after_create :build_other_records

	private
	def build_other_records
		AlumniStatus.create({ :Alumni_id => self.id })
		AlumniData.create({ :Alumni_id => self.id })
		TieAlumniWithStudentMember.create({ :Alumni_id => self.id, :StudentMember_id => 0})
		true
	end
end

class Alumni < ActiveRecord::Base
	has_one :AlumniStatus
	has_one :AlumniData
	after_create :build_other_records
	before_destroy { |record| AlumniStatus.destroy_all "Alumni_id = #{record.id}"   }
	before_destroy { |record| AlumniData.destroy_all "Alumni_id = #{record.id}"   }
	before_destroy { |record| TieAlumniWithStudentMember.destroy_all "Alumni_id = #{record.id}"   }

	private
	def build_other_records
		AlumniStatus.create({ :Alumni_id => self.id })
		AlumniData.create({ :Alumni_id => self.id })
		TieAlumniWithStudentMember.create({ :Alumni_id => self.id, :StudentMember_id => 0})
		true
	end
end

Add the before_destroy callback in Alumni model
Add the before_destroy callback in Alumni model

- Before destroying an Alumni, always destroy the associated
  AlumniStatus, AlumniData and the TieAlumni records too.

Signed-off-by: Siddharth Kannan <805f056820c7a1cecc4ab591b8a0a604b501a0b7@gmail.com>