X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/34e3e51456774127d43408b7ab65c24f41373f62..3aa69ffbdda5f111aed60d77e1a1eec8cdcad3ba:/app/models/redaction.rb diff --git a/app/models/redaction.rb b/app/models/redaction.rb index b3c5ec5ba..49de3177a 100644 --- a/app/models/redaction.rb +++ b/app/models/redaction.rb @@ -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