]> git.openstreetmap.org Git - rails.git/blob - app/models/message.rb
More tests, found a bug in the data browser, no fix yet. Fix db readme. Don't show...
[rails.git] / app / models / message.rb
1 require 'validators'
2
3 class Message < ActiveRecord::Base
4   belongs_to :sender, :class_name => "User", :foreign_key => :from_user_id
5   belongs_to :recipient, :class_name => "User", :foreign_key => :to_user_id
6
7   validates_presence_of :title, :body, :sent_on, :sender, :recipient
8   validates_length_of :title, :within => 1..255
9   validates_inclusion_of :message_read, :in => [ true, false ]
10   validates_associated :sender, :recipient
11   validates_as_utf8 :title
12 end