Sha256: 898e248030a00977acd050578ea09e94e0e6994a342a4b7e6b81de2b0dce7c96
Contents?: true
Size: 817 Bytes
Versions: 12
Compression:
Stored size: 817 Bytes
Contents
require "redcarpet" require "aasm" module PolicyManager class Term < ApplicationRecord include AASM validates_presence_of :rule validates_presence_of :description validates_presence_of :state aasm :column => :state do state :draft, :initial => true # db column's default state :published event :publish do transitions from: :draft, to: :published end event :unpublish do transitions from: :published, to: :draft end end def self.renderer @markdown = markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true) end def to_html self.class.renderer.render(self.description) end def rule PolicyManager::Config.rules.find{|o| o.name == self[:rule]} end end end
Version data entries
12 entries across 12 versions & 1 rubygems