Group common class_name
options in associations (#28779)
This commit is contained in:
parent
da31792ac7
commit
aaa6f2e930
5 changed files with 24 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue