Sha256: 208c8677b4a663a98cc77b127a40bc2b4e87422da6240bc1cf0d4703882baa2d
Contents?: true
Size: 716 Bytes
Versions: 15
Compression:
Stored size: 716 Bytes
Contents
# frozen_string_literal: true class <%=name%>Importer < ApplicationImporter # Whether the excel sheet should contain a header includes_header true # Whether to allow importing of duplicates allow_duplicates false # Whether to ignore the given header and use our internal mapping ignore_header false field 'id', 'record ID of the <%=name%> (only if you want to update)' field 'name', 'name of the <%=name%>' # Here you will build the record based on the row def build(row) record = <%=name%>.find_or_initialize_by(id: row['id']) record.name = row['name'] record end # Uncomment if you need to do something before saving the record # def before_save(record, _row) # end end
Version data entries
15 entries across 15 versions & 1 rubygems