Class: Decidim::Admin::OrganizationExternalDomainWhitelistForm

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

Instance Method Summary collapse

Instance Method Details

#external_domains_validatorObject


16
17
18
19
20
# File 'decidim-admin/app/forms/decidim/admin/organization_external_domain_whitelist_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_whitelist.form.domain_too_short")) if domain.value.length <= 3
  end.map(&:value).uniq
end

#map_model(model) ⇒ Object


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

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