Sha256: a98a3cc03218ccd2f622cffee874c7f2f5b1f4cecf8ad13c4286f7b8216bf8b1

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

module Elabs
  class Album < ApplicationContentRecord
    self.table_name = 'albums'

    ADDITIONAL_HABTM_COUNTER_CACHES = [
      %w[projects albums]
    ].freeze

    validates :name,        presence: true
    validates :description, presence: true
    validates_with AssociatedAuthorValidator, relations: %w[project upload]

    belongs_to :user
    belongs_to :license
    belongs_to :language
    has_many :albums_tags
    has_many :projects_albums
    has_many :albums_uploads
    has_many :tags,     through: :albums_tags,     dependent: :destroy
    has_many :projects, through: :projects_albums, dependent: :destroy
    has_many :uploads,  through: :albums_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/album.rb