account_note.rb 667 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: account_notes
  5. #
  6. # id :bigint(8) not null, primary key
  7. # account_id :bigint(8)
  8. # target_account_id :bigint(8)
  9. # comment :text not null
  10. # created_at :datetime not null
  11. # updated_at :datetime not null
  12. #
  13. class AccountNote < ApplicationRecord
  14. include RelationshipCacheable
  15. COMMENT_SIZE_LIMIT = 2_000
  16. belongs_to :account
  17. belongs_to :target_account, class_name: 'Account'
  18. validates :account_id, uniqueness: { scope: :target_account_id }
  19. validates :comment, length: { maximum: COMMENT_SIZE_LIMIT }
  20. end