1 # == Schema Information
 
   3 # Table name: redactions
 
   5 #  id                 :integer          not null, primary key
 
   6 #  title              :string           not null
 
   7 #  description        :text             not null
 
  10 #  user_id            :bigint           not null
 
  11 #  description_format :enum             default("markdown"), not null
 
  15 #  redactions_user_id_fkey  (user_id => users.id)
 
  19 # Redaction represents a record associated with a particular
 
  20 # action on the database to hide revisions from the history
 
  21 # which are not appropriate to redistribute any more.
 
  23 # The circumstances of the redaction can be recorded in the
 
  24 # record's title and description fields, which can be
 
  25 # displayed linked from the redacted records.
 
  27 class Redaction < ApplicationRecord
 
  32   has_many :old_relations
 
  34   validates :title, :presence => true, :characters => true
 
  35   validates :description, :presence => true, :characters => true
 
  36   validates :description_format, :inclusion => { :in => %w[text html markdown] }
 
  38   # this method overrides the AR default to provide the rich
 
  39   # text object for the description field.
 
  41     RichText.new(self[:description_format], self[:description])