]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Initial work on support for multiple editors
[rails.git] / app / models / user.rb
index 31b0f27a03428ef9223b3c00bfe05bd89504c27f..ecf93b6f790f5505d78ccaab1905e7e5827dec17 100644 (file)
@@ -28,9 +28,12 @@ class User < ActiveRecord::Base
   validates_email_format_of :email
   validates_email_format_of :new_email, :allow_blank => true
   validates_format_of :display_name, :with => /^[^\/;.,?]*$/
+  validates_format_of :display_name, :with => /^\S/, :message => "has leading whitespace"
+  validates_format_of :display_name, :with => /\S$/, :message => "has trailing whitespace"
   validates_numericality_of :home_lat, :allow_nil => true
   validates_numericality_of :home_lon, :allow_nil => true
   validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true
+  validates_inclusion_of :preferred_editor, :in => Editors::ALL_EDITORS, :allow_nil => true
 
   before_save :encrypt_password