Sha256: 0830bb31b5b7ba951ae8b881cafc73c195917e563368e6905b7380b0f4555542

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

module Elabs
  class Project < ApplicationContentRecord
    self.table_name = 'projects'

    validates :name,              presence: true
    validates :short_description, presence: true
    validates :description,       presence: true
    validates_with AssociatedAuthorValidator, relations: %w[album article note upload]

    belongs_to :user
    belongs_to :license
    belongs_to :language
    has_many :projects_tags
    has_many :projects_albums
    has_many :projects_articles
    has_many :projects_notes
    has_many :projects_uploads
    has_many :tags,     through: :projects_tags,     dependent: :destroy
    has_many :albums,   through: :projects_albums,   dependent: :destroy
    has_many :articles, through: :projects_articles, dependent: :destroy
    has_many :notes,    through: :projects_notes,    dependent: :destroy
    has_many :uploads,  through: :projects_uploads,  dependent: :destroy
    has_many :comments, as: 'content'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
elabs-2.0.0.pre app/models/elabs/project.rb