X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/34e3e51456774127d43408b7ab65c24f41373f62..e5834016fd30a975d162478469d030fc168d98fe:/app/models/redaction.rb?ds=sidebyside 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