account_warning.rb 800 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: account_warnings
  5. #
  6. # id :bigint(8) not null, primary key
  7. # account_id :bigint(8)
  8. # target_account_id :bigint(8)
  9. # action :integer default("none"), not null
  10. # text :text default(""), not null
  11. # created_at :datetime not null
  12. # updated_at :datetime not null
  13. #
  14. class AccountWarning < ApplicationRecord
  15. enum action: %i(none disable sensitive silence suspend), _suffix: :action
  16. belongs_to :account, inverse_of: :account_warnings
  17. belongs_to :target_account, class_name: 'Account', inverse_of: :targeted_account_warnings
  18. scope :latest, -> { order(created_at: :desc) }
  19. scope :custom, -> { where.not(text: '') }
  20. end