Class: Decidim::Admin::ParticipatorySpacePrivateUserCsvImportForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Admin::ParticipatorySpacePrivateUserCsvImportForm
- Includes:
- CustomImport, HasUploadValidations
- Defined in:
- 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_csv ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb', line 20 def validate_csv return if file.blank? process_import_file(file) do |(_email, user_name)| errors.add(:user_name, :invalid) if user_name.blank? || !user_name.match?(UserBaseEntity::REGEXP_NAME) end rescue CSV::MalformedCSVError errors.add(:file, :malformed) end |