0
0
Fork 0

Group common class_name options in associations (#28779)

This commit is contained in:
Matt Jankowski 2024-01-18 07:29:41 -05:00 committed by GitHub
parent da31792ac7
commit aaa6f2e930
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 11 deletions

View file

@ -20,8 +20,11 @@ class Appeal < ApplicationRecord
belongs_to :account
belongs_to :strike, class_name: 'AccountWarning', foreign_key: 'account_warning_id', inverse_of: :appeal
belongs_to :approved_by_account, class_name: 'Account', optional: true
belongs_to :rejected_by_account, class_name: 'Account', optional: true
with_options class_name: 'Account', optional: true do
belongs_to :approved_by_account
belongs_to :rejected_by_account
end
validates :text, presence: true, length: { maximum: 2_000 }
validates :account_warning_id, uniqueness: true