Class: Decidim::Admin::UserGroupCsvVerificationForm

Inherits:
Form
  • Object
show all
Includes:
HasUploadValidations, ProcessesFileLocally
Defined in:
app/forms/decidim/admin/user_group_csv_verification_form.rb

Overview

A form object used to upload CSV to batch verify user groups.

Instance Method Summary collapse

Instance Method Details

#validate_csvObject



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

def validate_csv
  process_file_locally(file) do |file_path|
    CSV.open(file_path, &:readline)
  end
rescue CSV::MalformedCSVError
  errors.add(:file, :malformed)
end