]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/note_comment.rb
Limit notes sizes to 2000 characters
[rails.git] / app / models / note_comment.rb
index f8450d0a369625be13158760ae3ae5eb70ec5635..c9caa1b8544c67e53736d887a7c5e6db2d378f79 100644 (file)
@@ -33,7 +33,8 @@ class NoteComment < ActiveRecord::Base
   validates :visible, :inclusion => [true, false]
   validates :author, :associated => true
   validates :event, :inclusion => %w[opened closed reopened commented hidden]
-  validates :body, :format => /\A[^\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff]*\z/
+  validates :body, :allow_blank => false, :length => { :maximum => 2000 },
+                   :format => /\A[^\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff]*\z/
 
   # Return the comment text
   def body