2016-11-15 10:56:29 -05:00
|
|
|
# frozen_string_literal: true
|
2017-05-01 20:14:47 -04:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: mentions
|
|
|
|
#
|
2018-04-23 05:29:17 -04:00
|
|
|
# id :bigint(8) not null, primary key
|
|
|
|
# status_id :bigint(8)
|
2017-05-01 20:14:47 -04:00
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
2018-04-23 05:29:17 -04:00
|
|
|
# account_id :bigint(8)
|
2017-05-01 20:14:47 -04:00
|
|
|
#
|
2016-11-15 10:56:29 -05:00
|
|
|
|
2016-08-17 11:56:23 -04:00
|
|
|
class Mention < ApplicationRecord
|
2018-01-19 14:56:47 -05:00
|
|
|
belongs_to :account, inverse_of: :mentions
|
|
|
|
belongs_to :status
|
2016-02-24 18:17:01 -05:00
|
|
|
|
2016-11-21 08:59:13 -05:00
|
|
|
has_one :notification, as: :activity, dependent: :destroy
|
|
|
|
|
2016-02-24 18:17:01 -05:00
|
|
|
validates :account, uniqueness: { scope: :status }
|
2017-05-31 14:38:17 -04:00
|
|
|
|
|
|
|
delegate(
|
|
|
|
:username,
|
|
|
|
:acct,
|
|
|
|
to: :account,
|
|
|
|
prefix: true
|
|
|
|
)
|
2016-02-24 18:17:01 -05:00
|
|
|
end
|