Shauna's reply is efficient if you want to model messages being sent to multiple people, but I am not sure it answers your immediate question.
Given your database schema the models should look something like:
User --- has_many :sent_messages, :classname => "Message", :foreign_key => :from_id has_many :received_messages, class_name => "Message", :foreign_key => :to_id
Messages --- belongs_to :sender, :classname => "User", :foreign_key => :from_id belongs_to :receiver, classname => "User", :foreign_key => :to_id