]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/redaction.rb
Increase whitespace between comments in the note popup
[rails.git] / app / models / redaction.rb
index ca0ea7232f02755a1e7ecee454c4a49c9ed2a683..43f5b3c7bf70ffb67d8a47d8509c31a9e9fb0a8f 100644 (file)
@@ -14,7 +14,19 @@ class Redaction < ActiveRecord::Base
   has_many :old_ways
   has_many :old_relations
 
   has_many :old_ways
   has_many :old_relations
 
+  after_initialize :set_defaults
+
+  # 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))
   end
   def description
     RichText.new(read_attribute(:description_format), read_attribute(:description))
   end
+
+  private
+
+  # set the default format to be markdown, in the absence of
+  # any other setting.
+  def set_defaults
+    self.description_format = "markdown" unless self.attribute_present?(:description_format)
+  end
 end
 end