about summary refs log tree commit diff
path: root/app/models/inline_media_attachment.rb
blob: faa8ca1ac8c7181bed7b056a8dfe4d8f41b9fe03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true
# == Schema Information
#
# Table name: inline_media_attachments
#
#  id                  :bigint(8)        not null, primary key
#  status_id           :bigint(8)
#  media_attachment_id :bigint(8)
#

class InlineMediaAttachment < ApplicationRecord
  include Cacheable

  validates :status_id, uniqueness: { scope: :media_attachment_id }

  belongs_to :status, inverse_of: :inlined_attachments
  belongs_to :media_attachment, inverse_of: :inlines

  cache_associated :status, :media_attachment
end