]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Force new users to enter their email address twice to try and avoid so
[rails.git] / app / models / user.rb
index 2ad45e8acd7d87ae6e63d01583548e3bfe9b9900..dc461e8555a34130b58fc38228e25ebb89e019e4 100644 (file)
@@ -5,11 +5,13 @@ class User < ActiveRecord::Base
   has_many :diary_entries, :order => 'created_at DESC'
   has_many :messages, :foreign_key => :to_user_id, :order => 'sent_on DESC'
   has_many :new_messages, :class_name => "Message", :foreign_key => :to_user_id, :conditions => "message_read = 0", :order => 'sent_on DESC'
+  has_many :sent_messages, :class_name => "Message", :foreign_key => :from_user_id, :order => 'sent_on DESC'
   has_many :friends
   has_many :tokens, :class_name => "UserToken"
   has_many :preferences, :class_name => "UserPreference"
 
   validates_presence_of :email, :display_name
+  validates_confirmation_of :email, :message => 'Email addresses must match'
   validates_confirmation_of :pass_crypt, :message => 'Password must match the confirmation password'
   validates_uniqueness_of :display_name, :allow_nil => true
   validates_uniqueness_of :email