Class: Decidim::Admin::OrganizationExternalDomainAllowlistForm

Inherits:
Form
  • Object
show all
Defined in:
app/forms/decidim/admin/organization_external_domain_allowlist_form.rb

Instance Method Summary collapse

Instance Method Details

#external_domains_validatorObject



16
17
18
19
20
# File 'app/forms/decidim/admin/organization_external_domain_allowlist_form.rb', line 16

def external_domains_validator
  @external_domains_validator ||= external_domains.reject(&:deleted).each do |domain|
    errors.add(:external_domains, I18n.t("decidim.admin.domain_allowlist.form.domain_too_short")) if domain.value.length <= 3
  end.map(&:value).uniq
end

#map_model(model) ⇒ Object



10
11
12
13
14
# File 'app/forms/decidim/admin/organization_external_domain_allowlist_form.rb', line 10

def map_model(model)
  self.external_domains = model.external_domain_allowlist.map do |external_domain|
    ExternalDomainForm.new(value: external_domain)
  end
end