Class: Decidim::Admin::ParticipatorySpacePrivateUserCsvImportForm

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

Overview

A form object used to upload CSV to batch participatory space private users.

Instance Method Summary collapse

Instance Method Details

#validate_csvObject


17
18
19
20
21
22
23
# File 'decidim-admin/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb', line 17

def validate_csv
  return if file.blank?

  CSV.foreach(file.path) do |, user_name|
    errors.add(:user_name, :invalid) unless user_name.match?(UserBaseEntity::REGEXP_NAME)
  end
end