]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/redaction.rb
Rework coordinates to avoid scientific formatting of small numbers. Fixes #1509
[rails.git] / app / models / redaction.rb
index b3c5ec5ba6753469a8b87c9cf6bb6af0fb4c36e0..04f002e3637ccf62c1f808dea10f3b22677e0074 100644 (file)
@@ -14,9 +14,12 @@ class Redaction < ActiveRecord::Base
   has_many :old_ways
   has_many :old_relations
 
+  validates :description, :presence => true
+  validates :description_format, :inclusion => { :in => %w[text html markdown] }
+
   # this method overrides the AR default to provide the rich
   # text object for the description field.
   def description
-    RichText.new(read_attribute(:description_format), read_attribute(:description))
+    RichText.new(self[:description_format], self[:description])
   end
 end