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
|
@ -21,8 +21,10 @@ class EmailDomainBlock < ApplicationRecord
|
|||
include DomainNormalizable
|
||||
include Paginable
|
||||
|
||||
belongs_to :parent, class_name: 'EmailDomainBlock', optional: true
|
||||
has_many :children, class_name: 'EmailDomainBlock', foreign_key: :parent_id, inverse_of: :parent, dependent: :destroy
|
||||
with_options class_name: 'EmailDomainBlock' do
|
||||
belongs_to :parent, optional: true
|
||||
has_many :children, foreign_key: :parent_id, inverse_of: :parent, dependent: :destroy
|
||||
end
|
||||
|
||||
validates :domain, presence: true, uniqueness: true, domain: true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue