mention.rb 593 Bytes
Newer Older
1
# frozen_string_literal: true
yhirano's avatar
yhirano committed
2 3 4 5
# == Schema Information
#
# Table name: mentions
#
6
#  status_id  :bigint
yhirano's avatar
yhirano committed
7 8
#  created_at :datetime         not null
#  updated_at :datetime         not null
9 10
#  account_id :bigint
#  id         :bigint           not null, primary key
yhirano's avatar
yhirano committed
11
#
12

Eugen Rochko's avatar
Eugen Rochko committed
13
class Mention < ApplicationRecord
Samy Kacimi's avatar
Samy Kacimi committed
14 15
  belongs_to :account, inverse_of: :mentions, required: true
  belongs_to :status, required: true
16

17 18
  has_one :notification, as: :activity, dependent: :destroy

19
  validates :account, uniqueness: { scope: :status }
20 21 22 23 24 25 26

  delegate(
    :username,
    :acct,
    to: :account,
    prefix: true
  )
27
end