X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/34e3e51456774127d43408b7ab65c24f41373f62..a402e811dac1f999dcf623ce6099e554d76c6de4:/app/models/redaction.rb?ds=inline diff --git a/app/models/redaction.rb b/app/models/redaction.rb index b3c5ec5ba..04f002e36 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