I have built the following model to handle user\'s message exchange:
create_table \"messages\", :force => true do |t|
t.integer \"source_id\"
t.
You can nullify on a deleted record with :dependent=>:nullify
has_many :sent_messages, :class_name=> 'Message', :foreign_key=>'source_id', :dependent=>:nullify
has_many :recieved_messages, :class_name=> 'Message', :foreign_key=>'destination_id', :dependent=>:nullify
You'll need to handle when displaying the message that the sender/receiver of the message has been deleted, since the sender_id or destination_id will be null, but the message will stay intact.