Sha256: 20be344b8aa869358113e07fdcd306499cf5816afeaf96a8c640bee69bd29eab
Contents?: true
Size: 923 Bytes
Versions: 2
Compression:
Stored size: 923 Bytes
Contents
module Elabs class Upload < ApplicationContentRecord self.table_name = 'uploads' ADDITIONAL_HABTM_COUNTER_CACHES = [ %w[albums uploads], %w[projects uploads] ].freeze validates :title, presence: true validates :description, presence: true validates :file_attachment, presence: true validates_with AssociatedAuthorValidator, relations: %w[album project] belongs_to :user belongs_to :license belongs_to :language has_many :uploads_tags has_many :projects_uploads has_many :albums_uploads has_many :tags, through: :uploads_tags, dependent: :destroy has_many :projects, through: :projects_uploads, dependent: :destroy has_many :albums, through: :albums_uploads, dependent: :destroy has_many :comments, as: 'content' has_one_attached :file scope :for_list, -> { order(:title).pluck(:title, :id) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
elabs-3.0.0 | app/models/elabs/upload.rb |
elabs-2.0.0 | app/models/elabs/upload.rb |