1 class Message < ActiveRecord::Base
2 belongs_to :sender, :class_name => "User", :foreign_key => :from_user_id
3 belongs_to :recipient, :class_name => "User", :foreign_key => :to_user_id
5 validates_presence_of :title, :body, :sent_on
6 validates_inclusion_of :message_read, :in => [ true, false ]
7 validates_associated :sender, :recipient