has_many :through

Whoops, I knew I'd forget something... change this line in the User
class to add the foreign_key.

has_and_belongs_to_many :received_messages, :class_name => 'Message',
:foreign_key => :recipient_id

has_and_belongs_to_many automatically assumes that the join table for
the association is named like this.

tablename1_tablename2

where tablename1 is the table that comes first alphabetically. So for
a has_anf_belong_to_many association, you have to rename your
message_users table to messages_users, OR:

has_and_belongs_to_many received_messages, :class_name =>
'Message', :foreign_key => :recipient_id, :join_table =>
"message_users"