Sha256: 8a42fec8f36f6d7b7437ee1b34c44432062ccfc57172d64b55166ec1b62fedb8
Contents?: true
Size: 1015 Bytes
Versions: 9
Compression:
Stored size: 1015 Bytes
Contents
require 'active_support/concern' module Georgia module Concerns module Revisionable extend ActiveSupport::Concern included do has_many :revisions, as: :revisionable, dependent: :destroy belongs_to :current_revision, class_name: Georgia::Revision, foreign_key: :revision_id delegate :title, :text, :excerpt, :keywords, :keyword_list, :image, to: :current_revision, allow_nil: true delegate :template, :content, :slides, :widgets, to: :current_revision, allow_nil: true delegate :draft?, :review?, :revision?, to: :current_revision, allow_nil: true def draft Georgia::Clone.new(self).draft end def store Georgia::Clone.new(self).store end def copy Georgia::Clone.new(self).copy end def approve_revision revision current_revision.store if current_revision self.update_attribute(:revision_id, revision.id) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems