]> git.openstreetmap.org Git - rails.git/blob - app/models/message.rb
Report a friendly error for attempts to reference a user that does
[rails.git] / app / models / message.rb
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
4
5   validates_presence_of :title, :body, :sent_on
6   validates_inclusion_of :message_read, :in => [ true, false ]
7   validates_associated :sender, :recipient
8 end