Sha256: 9c092fd421975a3bd94dfe0e4f2ad57b582c2f02db6262560f5e8d81a76ff9fe

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

module Georgia
  class Revision < ActiveRecord::Base

    include PublicActivity::Common
    include Concerns::Contentable

    enum status: [ :draft, :review, :published, :revision ]

    belongs_to :user, foreign_key: :revised_by_id

    has_one :page, foreign_key: :revision_id
    belongs_to :revisionable, polymorphic: true, touch: true

    has_many :slides, dependent: :destroy, foreign_key: :page_id
    accepts_nested_attributes_for :slides, allow_destroy: true

    has_many :ui_associations, dependent: :destroy, foreign_key: :page_id
    accepts_nested_attributes_for :ui_associations, allow_destroy: true

    has_many :widgets, through: :ui_associations

    validates :template, inclusion: {in: Georgia.templates, message: "%{value} is not a valid template" }

    delegate :visibility, to: :revisionable, prefix: false

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
georgia-0.8.0 app/models/georgia/revision.rb