mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
482 B
20 lines
482 B
# frozen_string_literal: true
|
|
|
|
module PartnershipValidation
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
validate :must_belong_to_account_or_partnership
|
|
end
|
|
|
|
private
|
|
|
|
def must_belong_to_account_or_partnership
|
|
if account.blank? && partnership.blank?
|
|
errors.add(:base, 'Must belong to either an account or partnership')
|
|
elsif account.present? && partnership.present?
|
|
errors.add(:base, 'Cannot belong to both account and partnership')
|
|
end
|
|
end
|
|
end
|